Skip to content

Commit

Permalink
style: lint with clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonribble committed Oct 9, 2024
1 parent dca9632 commit 3ff86c3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/db/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ pub struct Connection {
}

impl Connection {
#[must_use]
pub fn new(pool: SqlitePool) -> Self {
Self {
sqlite_pool: Arc::new(pool),
Expand Down
6 changes: 6 additions & 0 deletions src/models/contact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ pub struct Construct {
pub update: Update,
}
impl Construct {
/// # Errors
///
/// This errors if there is an invalid email or phone number
pub fn new(
id: i64,
first_name: Option<String>,
Expand Down Expand Up @@ -90,6 +93,9 @@ impl Construct {
}

impl Contact {
/// # Errors
///
/// This errors if there is an invalid email or phone number
pub fn new(
first_name: &str,
last_name: &str,
Expand Down
2 changes: 1 addition & 1 deletion src/models/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct Metadata {
}

impl Metadata {
#[allow(dead_code)]
#[must_use]
pub fn new(contact_id: i64) -> Self {
let now = Utc::now();

Expand Down
2 changes: 2 additions & 0 deletions src/utils/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ fn is_valid_phone_number(phone: &str) -> bool {
phone_regex.is_match(phone)
}

#[must_use]
pub fn is_not_valid_phone_number(phone_number: &str) -> bool {
!is_valid_phone_number(phone_number)
}
Expand All @@ -17,6 +18,7 @@ fn is_valid_email(email: &str) -> bool {
email_regex.is_match(email)
}

#[must_use]
pub fn is_not_valid_email(email: &str) -> bool {
!is_valid_email(email)
}
Expand Down

0 comments on commit 3ff86c3

Please sign in to comment.