diff --git a/dt-core/src/item.rs b/dt-core/src/item.rs index 779d447..e5387ba 100644 --- a/dt-core/src/item.rs +++ b/dt-core/src/item.rs @@ -152,7 +152,7 @@ impl Operate for PathBuf { /// Reference: fn absolute(self) -> Result { let absolute_path = if self.is_absolute() { - self.to_owned() + self } else { std::env::current_dir()?.join(self) } @@ -165,7 +165,7 @@ impl Operate for PathBuf { /// host-specific, returns `self` directly. fn host_specific(self, hostname_sep: &str) -> Self { if self.ends_with(utils::host_specific_suffix(hostname_sep)) { - self.into() + self } else { let hs_filename = self .file_name() @@ -417,7 +417,7 @@ impl Operate for PathBuf { renaming_rules: Vec, ) -> Result { // Get non-host-specific counterpart of `self` - let nhself = self.to_owned().non_host_specific(hostname_sep); + let nhself = self.non_host_specific(hostname_sep); // Get non-host-specific counterpart of `base` let base = base.to_owned().non_host_specific(hostname_sep); diff --git a/dt-core/src/lib.rs b/dt-core/src/lib.rs index 3f14227..0d38c03 100644 --- a/dt-core/src/lib.rs +++ b/dt-core/src/lib.rs @@ -254,7 +254,6 @@ sources = ["{}"] )?, ); - let test_username = "watson"; let config = expand(DTConfig::from_str(&format!( r#" [context.user] diff --git a/dt-core/src/registry.rs b/dt-core/src/registry.rs index 2de7b3a..f6221af 100644 --- a/dt-core/src/registry.rs +++ b/dt-core/src/registry.rs @@ -346,7 +346,7 @@ Block helper `#{0}`: .unwrap() .to_string_lossy() .to_string(); - if allowed_usernames.len() > 0 { + if !allowed_usernames.is_empty() { if allowed_usernames.contains(¤t_username) { log::debug!( "Current username '{}' matches allowed usernames '{:?}'", @@ -472,7 +472,7 @@ Block helper `#{0}`: .unwrap() .to_string_lossy() .to_string(); - if disallowed_usernames.len() > 0 { + if !disallowed_usernames.is_empty() { if disallowed_usernames.contains(¤t_username) { log::debug!( "Current username '{}' matches disallowed usernames '{:?}'", @@ -592,7 +592,7 @@ Block helper `#{0}`: }; let current_uid = get_current_uid(); - if allowed_uids.len() > 0 { + if !allowed_uids.is_empty() { if allowed_uids.contains(¤t_uid) { log::debug!( "Current uid '{}' matches allowed uids '{:?}'", @@ -713,7 +713,7 @@ Block helper `#{0}`: }; let current_uid = get_current_uid(); - if disallowed_uids.len() > 0 { + if !disallowed_uids.is_empty() { if disallowed_uids.contains(¤t_uid) { log::debug!( "Current uid '{}' matches disallowed uids '{:?}'", @@ -835,7 +835,7 @@ Block helper `#{0}`: let current_hostname = gethostname(); let current_hostname: String = current_hostname.to_string_lossy().to_string(); - if allowed_hostnames.len() > 0 { + if !allowed_hostnames.is_empty() { if allowed_hostnames.contains(¤t_hostname) { log::debug!( "Current hostname '{}' matches allowed hostnames '{:?}'", @@ -958,7 +958,7 @@ Block helper `#{0}`: let current_hostname = gethostname(); let current_hostname: String = current_hostname.to_string_lossy().to_string(); - if disallowed_hostnames.len() > 0 { + if !disallowed_hostnames.is_empty() { if disallowed_hostnames.contains(¤t_hostname) { log::debug!( "Current hostname '{}' matches disallowed hostnames '{:?}'", diff --git a/dt-core/src/syncing.rs b/dt-core/src/syncing.rs index 020dd8d..17e0fcb 100644 --- a/dt-core/src/syncing.rs +++ b/dt-core/src/syncing.rs @@ -343,6 +343,7 @@ pub fn sync(config: DTConfig, dry_run: bool) -> Result<()> { } } } else { + #[allow(clippy::collapsible_else_if)] if let Err(e) = spath .populate(Rc::clone(&group_ref), Rc::clone(®istry)) {