Fix clippy::needless_borrow lint violations (#36444)
Release Notes: - N/A
This commit is contained in:
parent
eecf142f06
commit
9e0e233319
242 changed files with 801 additions and 821 deletions
|
@ -210,7 +210,7 @@ impl FileFinder {
|
|||
return;
|
||||
};
|
||||
if self.picker.read(cx).delegate.has_changed_selected_index {
|
||||
if !event.modified() || !init_modifiers.is_subset_of(&event) {
|
||||
if !event.modified() || !init_modifiers.is_subset_of(event) {
|
||||
self.init_modifiers = None;
|
||||
window.dispatch_action(menu::Confirm.boxed_clone(), cx);
|
||||
}
|
||||
|
@ -497,7 +497,7 @@ impl Match {
|
|||
fn panel_match(&self) -> Option<&ProjectPanelOrdMatch> {
|
||||
match self {
|
||||
Match::History { panel_match, .. } => panel_match.as_ref(),
|
||||
Match::Search(panel_match) => Some(&panel_match),
|
||||
Match::Search(panel_match) => Some(panel_match),
|
||||
Match::CreateNew(_) => None,
|
||||
}
|
||||
}
|
||||
|
@ -537,7 +537,7 @@ impl Matches {
|
|||
self.matches.binary_search_by(|m| {
|
||||
// `reverse()` since if cmp_matches(a, b) == Ordering::Greater, then a is better than b.
|
||||
// And we want the better entries go first.
|
||||
Self::cmp_matches(self.separate_history, currently_opened, &m, &entry).reverse()
|
||||
Self::cmp_matches(self.separate_history, currently_opened, m, entry).reverse()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1082,7 +1082,7 @@ impl FileFinderDelegate {
|
|||
if let Some(user_home_path) = std::env::var("HOME").ok() {
|
||||
let user_home_path = user_home_path.trim();
|
||||
if !user_home_path.is_empty() {
|
||||
if (&full_path).starts_with(user_home_path) {
|
||||
if full_path.starts_with(user_home_path) {
|
||||
full_path.replace_range(0..user_home_path.len(), "~");
|
||||
full_path_positions.retain_mut(|pos| {
|
||||
if *pos >= user_home_path.len() {
|
||||
|
@ -1402,7 +1402,7 @@ impl PickerDelegate for FileFinderDelegate {
|
|||
cx.notify();
|
||||
Task::ready(())
|
||||
} else {
|
||||
let path_position = PathWithPosition::parse_str(&raw_query);
|
||||
let path_position = PathWithPosition::parse_str(raw_query);
|
||||
|
||||
#[cfg(windows)]
|
||||
let raw_query = raw_query.trim().to_owned().replace("/", "\\");
|
||||
|
|
|
@ -1614,7 +1614,7 @@ async fn test_select_current_open_file_when_no_history(cx: &mut gpui::TestAppCon
|
|||
|
||||
let picker = open_file_picker(&workspace, cx);
|
||||
picker.update(cx, |finder, _| {
|
||||
assert_match_selection(&finder, 0, "1_qw");
|
||||
assert_match_selection(finder, 0, "1_qw");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -2623,7 +2623,7 @@ async fn open_queried_buffer(
|
|||
workspace: &Entity<Workspace>,
|
||||
cx: &mut gpui::VisualTestContext,
|
||||
) -> Vec<FoundPath> {
|
||||
let picker = open_file_picker(&workspace, cx);
|
||||
let picker = open_file_picker(workspace, cx);
|
||||
cx.simulate_input(input);
|
||||
|
||||
let history_items = picker.update(cx, |finder, _| {
|
||||
|
|
|
@ -637,7 +637,7 @@ impl PickerDelegate for OpenPathDelegate {
|
|||
FileIcons::get_folder_icon(false, cx)?
|
||||
} else {
|
||||
let path = path::Path::new(&candidate.path.string);
|
||||
FileIcons::get_icon(&path, cx)?
|
||||
FileIcons::get_icon(path, cx)?
|
||||
};
|
||||
Some(Icon::from_path(icon).color(Color::Muted))
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue