Skip to content

Commit

Permalink
thanks clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jan 27, 2025
1 parent 73224e6 commit 092a6c5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/interactive/app/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ pub fn sorted_entries(
tree.neighbors_directed(node_idx, Direction::Outgoing)
.filter_map(|idx| {
tree.node_weight(idx).map(|entry| {
let use_glob_path = glob_root.map_or(false, |glob_root| glob_root == node_idx);
let use_glob_path = glob_root.is_some_and(|glob_root| glob_root == node_idx);
let (path, exists, is_dir) = {
let path = path_of(tree, idx, glob_root);
if matches!(check, EntryCheck::Disabled) || glob_root == Some(node_idx) {
(path, true, entry.is_dir)
} else {
let meta = path.symlink_metadata();
(path, meta.is_ok(), meta.ok().map_or(false, |m| m.is_dir()))
(path, meta.is_ok(), meta.ok().is_some_and(|m| m.is_dir()))
}
};
EntryDataBundle {
Expand Down
14 changes: 8 additions & 6 deletions src/interactive/app/tests/journeys_readonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,10 @@ fn simple_user_journey_read_only() -> Result<()> {
"it marks only a single node",
);
assert!(
app.window.mark_pane.as_ref().map_or(false, |p| p
.marked()
.contains_key(&previously_selected_index)),
app.window
.mark_pane
.as_ref()
.is_some_and(|p| p.marked().contains_key(&previously_selected_index)),
"it marks the selected node"
);
assert_eq!(
Expand Down Expand Up @@ -355,9 +356,10 @@ fn simple_user_journey_read_only() -> Result<()> {
);

assert!(
app.window.mark_pane.as_ref().map_or(false, |p| p
.marked()
.contains_key(&previously_selected_index)),
app.window
.mark_pane
.as_ref()
.is_some_and(|p| p.marked().contains_key(&previously_selected_index)),
"it leaves the first selected item marked"
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/interactive/widgets/glob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl GlobPane {
self.input
.graphemes(true)
.take(self.cursor_grapheme_idx)
.map(|g| g.as_bytes().len())
.map(|g| g.len())
.sum::<usize>(),
new_char,
);
Expand Down
2 changes: 1 addition & 1 deletion src/traverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ impl BackgroundTraversal {
}
}

if self.throttle.as_ref().map_or(false, |t| t.can_update()) {
if self.throttle.as_ref().is_some_and(|t| t.can_update()) {
return Some(false);
}
}
Expand Down

0 comments on commit 092a6c5

Please sign in to comment.