Skip to content

Commit

Permalink
chore: apply clippy lint suggestions
Browse files Browse the repository at this point in the history
warning: redundant field names in struct initialization
   --> src/cmd/validate.rs:371:13
    |
371 |             cache_age_secs: cache_age_secs,
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `cache_age_secs`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
    = note: `#[warn(clippy::redundant_field_names)]` on by default

warning: redundant field names in struct initialization
   --> src/cmd/validate.rs:375:13
    |
375 |             ckan_token: ckan_token,
    |             ^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `ckan_token`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: using `clone` on type `Option<Delimiter>` which implements the `Copy` trait
   --> src/cmd/validate.rs:362:13
    |
362 |             delim.clone()
    |             ^^^^^^^^^^^^^ help: try dereferencing it: `*delim`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
    = note: `#[warn(clippy::clone_on_copy)]` on by default

warning: the borrowed expression implements the required traits
  --> src/lookup.rs:43:41
   |
43 |         let expanded_dir = expand_tilde(&cache_dir).unwrap();
   |                                         ^^^^^^^^^^ help: change this to: `cache_dir`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
   = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default
  • Loading branch information
jqnatividad committed Nov 1, 2024
1 parent 2d67e3b commit a19d4cd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/cmd/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ fn dyn_enum_validator_factory<'a>(
};

let delimiter = if let Some(delim) = DELIMITER.get() {
delim.clone()
*delim
} else {
None
};
Expand All @@ -368,11 +368,11 @@ fn dyn_enum_validator_factory<'a>(
let opts = LookupTableOptions {
name: lookup_name,
uri: uri.clone(),
cache_age_secs: cache_age_secs,
cache_age_secs,
cache_dir: QSV_CACHE_DIR.get().unwrap().to_string(),
delimiter,
ckan_api_url: CKAN_API.get().cloned(),
ckan_token: ckan_token,
ckan_token,
timeout_secs: TIMEOUT_SECS.load(Ordering::Relaxed),
};

Expand Down
2 changes: 1 addition & 1 deletion src/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub fn set_qsv_cache_dir(cache_dir: &str) -> Result<String, CliError> {
}
} else if cache_dir.starts_with('~') {
// expand the tilde
let expanded_dir = expand_tilde(&cache_dir).unwrap();
let expanded_dir = expand_tilde(cache_dir).unwrap();
expanded_dir.to_string_lossy().to_string()
} else {
cache_dir.to_string()
Expand Down

0 comments on commit a19d4cd

Please sign in to comment.