Skip to content

Commit ea8025b

Browse files
committed
style: Fix all clippy pedantic warnings and formatting
- Add backticks to LinkedIn mentions in documentation - Fix semicolon consistency in examples - Apply cargo fmt formatting fixes - All clippy pedantic and nursery checks now pass
1 parent 5a56a2f commit ea8025b

File tree

2 files changed

+25
-29
lines changed

2 files changed

+25
-29
lines changed

examples/basic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ fn main() {
4242
match validator.is_valid_linkedin_profile_url(url) {
4343
Ok(_) => println!("{url}: ✓ Profile exists"),
4444
Err(LinkedInUrlError::ProfileNotFound) => {
45-
println!("{url}: ✗ Profile not found")
45+
println!("{url}: ✗ Profile not found");
4646
}
4747
Err(LinkedInUrlError::AuthenticationRequired) => {
48-
println!("{url}: ⚠ LinkedIn requires authentication")
48+
println!("{url}: ⚠ LinkedIn requires authentication");
4949
}
5050
Err(e) => println!("{url}: ✗ Error: {e}"),
5151
}
@@ -61,7 +61,7 @@ fn main() {
6161
println!(
6262
"{}: ⚠ LinkedIn requires authentication (async)",
6363
test_urls[0]
64-
)
64+
);
6565
}
6666
Err(e) => println!("{}: ✗ Error: {e}", test_urls[0]),
6767
}

src/lib.rs

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
//! LinkedIn profile URL validation library.
1+
//! `LinkedIn` profile URL validation library.
22
//!
3-
//! This crate provides tools to validate LinkedIn profile URLs by checking both
3+
//! This crate provides tools to validate `LinkedIn` profile URLs by checking both
44
//! format correctness and profile existence through HTTP requests.
55
//!
66
//! # Features
@@ -40,35 +40,35 @@ use regex::Regex;
4040
use thiserror::Error;
4141
use url::Url;
4242

43-
/// Errors that can occur during LinkedIn URL validation.
43+
/// Errors that can occur during `LinkedIn` URL validation.
4444
#[derive(Error, Debug)]
4545
pub enum LinkedInUrlError {
4646
/// The provided URL has invalid format.
4747
#[error("Invalid URL format: {0}")]
4848
InvalidUrl(String),
4949

50-
/// The URL is not from LinkedIn domain.
50+
/// The URL is not from `LinkedIn` domain.
5151
#[error("Not a LinkedIn URL")]
5252
NotLinkedInUrl,
5353

54-
/// The URL is from LinkedIn but not a profile URL.
54+
/// The URL is from `LinkedIn` but not a profile URL.
5555
#[error("Not a LinkedIn profile URL")]
5656
NotProfileUrl,
5757

5858
/// Network error occurred during validation.
5959
#[error("Network error: {0}")]
6060
NetworkError(#[from] reqwest::Error),
6161

62-
/// The LinkedIn profile was not found (404).
62+
/// The `LinkedIn` profile was not found (404).
6363
#[error("Profile not found (404)")]
6464
ProfileNotFound,
6565

66-
/// LinkedIn requires authentication to verify the profile.
66+
/// `LinkedIn` requires authentication to verify the profile.
6767
#[error("Unable to verify - LinkedIn requires authentication")]
6868
AuthenticationRequired,
6969
}
7070

71-
/// A LinkedIn profile validator that performs HTTP requests to verify profile existence.
71+
/// A `LinkedIn` profile validator that performs HTTP requests to verify profile existence.
7272
///
7373
/// # Example
7474
///
@@ -83,7 +83,7 @@ pub struct LinkedInValidator {
8383
}
8484

8585
impl LinkedInValidator {
86-
/// Creates a new LinkedIn validator instance.
86+
/// Creates a new `LinkedIn` validator instance.
8787
///
8888
/// # Panics
8989
///
@@ -99,13 +99,13 @@ impl LinkedInValidator {
9999
Self { client }
100100
}
101101

102-
/// Validates a LinkedIn profile URL by checking format and existence.
102+
/// Validates a `LinkedIn` profile URL by checking format and existence.
103103
///
104104
/// This method performs an HTTP request to verify if the profile actually exists.
105105
///
106106
/// # Arguments
107107
///
108-
/// * `url_str` - The LinkedIn profile URL to validate
108+
/// * `url_str` - The `LinkedIn` profile URL to validate
109109
///
110110
/// # Returns
111111
///
@@ -116,11 +116,11 @@ impl LinkedInValidator {
116116
///
117117
/// Returns an error if:
118118
/// - The URL format is invalid
119-
/// - The URL is not from LinkedIn domain
119+
/// - The URL is not from `LinkedIn` domain
120120
/// - The URL is not a profile URL
121121
/// - Network request fails
122122
/// - The profile doesn't exist (404)
123-
/// - LinkedIn requires authentication
123+
/// - `LinkedIn` requires authentication
124124
///
125125
/// # Example
126126
///
@@ -205,14 +205,14 @@ impl Default for LinkedInValidator {
205205
}
206206
}
207207

208-
/// Validates a LinkedIn profile URL asynchronously.
208+
/// Validates a `LinkedIn` profile URL asynchronously.
209209
///
210210
/// This function performs an HTTP request to verify if the profile actually exists.
211211
/// Use this for async contexts like web servers.
212212
///
213213
/// # Arguments
214214
///
215-
/// * `url` - The LinkedIn profile URL to validate
215+
/// * `url` - The `LinkedIn` profile URL to validate
216216
///
217217
/// # Returns
218218
///
@@ -223,11 +223,11 @@ impl Default for LinkedInValidator {
223223
///
224224
/// Returns an error if:
225225
/// - The URL format is invalid
226-
/// - The URL is not from LinkedIn domain
226+
/// - The URL is not from `LinkedIn` domain
227227
/// - The URL is not a profile URL
228228
/// - Network request fails
229229
/// - The profile doesn't exist (404)
230-
/// - LinkedIn requires authentication
230+
/// - `LinkedIn` requires authentication
231231
///
232232
/// # Example
233233
///
@@ -293,7 +293,7 @@ pub async fn validate_linkedin_url_async(url: &str) -> Result<bool, LinkedInUrlE
293293
Ok(true)
294294
}
295295

296-
/// Checks if a URL has valid LinkedIn profile format without making network calls.
296+
/// Checks if a URL has valid `LinkedIn` profile format without making network calls.
297297
///
298298
/// This function only validates the URL format and does not check if the profile exists.
299299
/// Use this for quick validation without network overhead.
@@ -304,8 +304,8 @@ pub async fn validate_linkedin_url_async(url: &str) -> Result<bool, LinkedInUrlE
304304
///
305305
/// # Returns
306306
///
307-
/// * `true` - If the URL has valid LinkedIn profile format
308-
/// * `false` - If the URL is invalid or not a LinkedIn profile URL
307+
/// * `true` - If the URL has valid `LinkedIn` profile format
308+
/// * `false` - If the URL is invalid or not a `LinkedIn` profile URL
309309
///
310310
/// # Example
311311
///
@@ -389,9 +389,7 @@ mod tests {
389389
Err(LinkedInUrlError::AuthenticationRequired) => {
390390
println!("LinkedIn requires authentication - cannot verify profile existence");
391391
}
392-
Err(e) => panic!(
393-
"Expected ProfileNotFound or AuthenticationRequired error, got: {e}"
394-
),
392+
Err(e) => panic!("Expected ProfileNotFound or AuthenticationRequired error, got: {e}"),
395393
}
396394
}
397395

@@ -421,9 +419,7 @@ mod tests {
421419
Err(LinkedInUrlError::AuthenticationRequired) => {
422420
println!("LinkedIn requires authentication - cannot verify profile existence");
423421
}
424-
Err(e) => panic!(
425-
"Expected ProfileNotFound or AuthenticationRequired error, got: {e}"
426-
),
422+
Err(e) => panic!("Expected ProfileNotFound or AuthenticationRequired error, got: {e}"),
427423
}
428424
}
429425

0 commit comments

Comments
 (0)