Fix clippy::needless_borrow lint violations (#36444)

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-08-18 23:54:35 +02:00 committed by GitHub
parent eecf142f06
commit 9e0e233319
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
242 changed files with 801 additions and 821 deletions

View file

@ -95,7 +95,7 @@ impl VimOption {
}
}
Self::possibilities(&prefix)
Self::possibilities(prefix)
.map(|possible| {
let mut options = prefix_of_options.clone();
options.push(possible);

View file

@ -2280,8 +2280,8 @@ fn go_to_line(map: &DisplaySnapshot, display_point: DisplayPoint, line: usize) -
}
let mut last_position = None;
for (excerpt, buffer, range) in map.buffer_snapshot.excerpts() {
let excerpt_range = language::ToOffset::to_offset(&range.context.start, &buffer)
..language::ToOffset::to_offset(&range.context.end, &buffer);
let excerpt_range = language::ToOffset::to_offset(&range.context.start, buffer)
..language::ToOffset::to_offset(&range.context.end, buffer);
if offset >= excerpt_range.start && offset <= excerpt_range.end {
let text_anchor = buffer.anchor_after(offset);
let anchor = Anchor::in_buffer(excerpt, buffer.remote_id(), text_anchor);
@ -2882,7 +2882,7 @@ fn method_motion(
} else {
possibilities.min().unwrap_or(offset)
};
let new_point = map.clip_point(dest.to_display_point(&map), Bias::Left);
let new_point = map.clip_point(dest.to_display_point(map), Bias::Left);
if new_point == display_point {
break;
}
@ -2936,7 +2936,7 @@ fn comment_motion(
} else {
possibilities.min().unwrap_or(offset)
};
let new_point = map.clip_point(dest.to_display_point(&map), Bias::Left);
let new_point = map.clip_point(dest.to_display_point(map), Bias::Left);
if new_point == display_point {
break;
}
@ -3003,7 +3003,7 @@ fn section_motion(
possibilities.min().unwrap_or(map.buffer_snapshot.len())
};
let new_point = map.clip_point(offset.to_display_point(&map), Bias::Left);
let new_point = map.clip_point(offset.to_display_point(map), Bias::Left);
if new_point == display_point {
break;
}

View file

@ -155,7 +155,7 @@ fn increment_decimal_string(num: &str, delta: i64) -> String {
}
fn increment_hex_string(num: &str, delta: i64) -> String {
let result = if let Ok(val) = u64::from_str_radix(&num, 16) {
let result = if let Ok(val) = u64::from_str_radix(num, 16) {
val.wrapping_add_signed(delta)
} else {
u64::MAX
@ -181,7 +181,7 @@ fn should_use_lowercase(num: &str) -> bool {
}
fn increment_binary_string(num: &str, delta: i64) -> String {
let result = if let Ok(val) = u64::from_str_radix(&num, 2) {
let result = if let Ok(val) = u64::from_str_radix(num, 2) {
val.wrapping_add_signed(delta)
} else {
u64::MAX

View file

@ -549,7 +549,7 @@ mod test {
cx.set_neovim_option("nowrap").await;
let content = "ˇ01234567890123456789";
cx.set_shared_state(&content).await;
cx.set_shared_state(content).await;
cx.simulate_shared_keystrokes("z shift-l").await;
cx.shared_state().await.assert_eq("012345ˇ67890123456789");
@ -560,7 +560,7 @@ mod test {
cx.shared_state().await.assert_eq("012345ˇ67890123456789");
let content = "ˇ01234567890123456789";
cx.set_shared_state(&content).await;
cx.set_shared_state(content).await;
cx.simulate_shared_keystrokes("z l").await;
cx.shared_state().await.assert_eq("0ˇ1234567890123456789");

View file

@ -540,7 +540,7 @@ impl MarksState {
cx: &mut Context<Self>,
) {
let buffer = multibuffer.read(cx).as_singleton();
let abs_path = buffer.as_ref().and_then(|b| self.path_for_buffer(&b, cx));
let abs_path = buffer.as_ref().and_then(|b| self.path_for_buffer(b, cx));
let Some(abs_path) = abs_path else {
self.multibuffer_marks
@ -606,7 +606,7 @@ impl MarksState {
match target? {
MarkLocation::Buffer(entity_id) => {
let anchors = self.multibuffer_marks.get(&entity_id)?;
let anchors = self.multibuffer_marks.get(entity_id)?;
return Some(Mark::Buffer(*entity_id, anchors.get(name)?.clone()));
}
MarkLocation::Path(path) => {
@ -636,7 +636,7 @@ impl MarksState {
match target {
MarkLocation::Buffer(entity_id) => {
self.multibuffer_marks
.get_mut(&entity_id)
.get_mut(entity_id)
.map(|m| m.remove(&mark_name.clone()));
return;
}
@ -1042,7 +1042,7 @@ impl Operator {
} => format!("^K{}", make_visible(&first_char.to_string())),
Operator::Literal {
prefix: Some(prefix),
} => format!("^V{}", make_visible(&prefix)),
} => format!("^V{}", make_visible(prefix)),
Operator::AutoIndent => "=".to_string(),
Operator::ShellCommand => "=".to_string(),
_ => self.id().to_string(),

View file

@ -67,7 +67,7 @@ impl NeovimConnection {
// Ensure we don't create neovim connections in parallel
let _lock = NEOVIM_LOCK.lock();
let (nvim, join_handle, child) = new_child_cmd(
&mut Command::new("nvim")
Command::new("nvim")
.arg("--embed")
.arg("--clean")
// disable swap (otherwise after about 1000 test runs you run out of swap file names)
@ -161,7 +161,7 @@ impl NeovimConnection {
#[cfg(feature = "neovim")]
pub async fn set_state(&mut self, marked_text: &str) {
let (text, selections) = parse_state(&marked_text);
let (text, selections) = parse_state(marked_text);
let nvim_buffer = self
.nvim

View file

@ -265,7 +265,7 @@ pub fn init(cx: &mut App) {
workspace.register_action(|workspace, _: &MaximizePane, window, cx| {
let pane = workspace.active_pane();
let Some(size) = workspace.bounding_box_for_pane(&pane) else {
let Some(size) = workspace.bounding_box_for_pane(pane) else {
return;
};
@ -1599,7 +1599,7 @@ impl Vim {
second_char,
smartcase: VimSettings::get_global(cx).use_smartcase_find,
};
Vim::globals(cx).last_find = Some((&sneak).clone());
Vim::globals(cx).last_find = Some(sneak.clone());
self.motion(sneak, window, cx)
}
} else {
@ -1616,7 +1616,7 @@ impl Vim {
second_char,
smartcase: VimSettings::get_global(cx).use_smartcase_find,
};
Vim::globals(cx).last_find = Some((&sneak).clone());
Vim::globals(cx).last_find = Some(sneak.clone());
self.motion(sneak, window, cx)
}
} else {

View file

@ -414,7 +414,7 @@ impl Vim {
);
}
let original_point = selection.tail().to_point(&map);
let original_point = selection.tail().to_point(map);
if let Some(range) = object.range(map, mut_selection, around, count) {
if !range.is_empty() {