Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso committed May 9, 2023
1 parent d7188d7 commit 75c3d6e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/system/bookmarks_client.rs
Expand Up @@ -730,7 +730,7 @@ mod tests {
// Limit is 2
assert_eq!(client.iter_recents().count(), 2);
// Check that 192.168.1.1 has been removed
let key: String = client.iter_recents().nth(0).unwrap().to_string();
let key: String = client.iter_recents().next().unwrap().to_string();
assert!(matches!(
client
.hosts
Expand Down
4 changes: 2 additions & 2 deletions src/system/environment.rs
Expand Up @@ -19,7 +19,7 @@ pub fn init_config_dir() -> Result<Option<PathBuf>, String> {
}

if let Some(dir) = CONF_DIR.as_deref() {
init_dir(&dir).map(Option::Some)
init_dir(dir).map(Option::Some)
} else {
Ok(None)
}
Expand All @@ -39,7 +39,7 @@ pub fn init_cache_dir() -> Result<Option<PathBuf>, String> {
}

if let Some(dir) = CACHE_DIR.as_deref() {
init_dir(&dir).map(Option::Some)
init_dir(dir).map(Option::Some)
} else {
Ok(None)
}
Expand Down
20 changes: 8 additions & 12 deletions src/utils/path.rs
Expand Up @@ -123,24 +123,20 @@ mod test {

#[test]
fn should_tell_whether_path_is_child_of() {
assert_eq!(
is_child_of(Path::new("/home/foo/foo.txt"), Path::new("/home"),),
true
assert!(
is_child_of(Path::new("/home/foo/foo.txt"), Path::new("/home"),)
);
assert_eq!(
is_child_of(Path::new("/home/foo/foo.txt"), Path::new("/home/foo/"),),
true
assert!(
is_child_of(Path::new("/home/foo/foo.txt"), Path::new("/home/foo/"),)
);
assert_eq!(
assert!(
is_child_of(
Path::new("/home/foo/foo.txt"),
Path::new("/home/foo/foo.txt"),
),
true
)
);
assert_eq!(
is_child_of(Path::new("/home/foo/foo.txt"), Path::new("/tmp"),),
false
assert!(
!is_child_of(Path::new("/home/foo/foo.txt"), Path::new("/tmp"),)
);
}
}

0 comments on commit 75c3d6e

Please sign in to comment.