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

@ -693,7 +693,7 @@ impl DebugPanel {
)
.icon_size(IconSize::Small)
.on_click(window.listener_for(
&running_state,
running_state,
|this, _, _window, cx| {
this.pause_thread(cx);
},
@ -719,7 +719,7 @@ impl DebugPanel {
)
.icon_size(IconSize::Small)
.on_click(window.listener_for(
&running_state,
running_state,
|this, _, _window, cx| this.continue_thread(cx),
))
.disabled(thread_status != ThreadStatus::Stopped)
@ -742,7 +742,7 @@ impl DebugPanel {
IconButton::new("debug-step-over", IconName::ArrowRight)
.icon_size(IconSize::Small)
.on_click(window.listener_for(
&running_state,
running_state,
|this, _, _window, cx| {
this.step_over(cx);
},
@ -768,7 +768,7 @@ impl DebugPanel {
)
.icon_size(IconSize::Small)
.on_click(window.listener_for(
&running_state,
running_state,
|this, _, _window, cx| {
this.step_in(cx);
},
@ -791,7 +791,7 @@ impl DebugPanel {
IconButton::new("debug-step-out", IconName::ArrowUpRight)
.icon_size(IconSize::Small)
.on_click(window.listener_for(
&running_state,
running_state,
|this, _, _window, cx| {
this.step_out(cx);
},
@ -815,7 +815,7 @@ impl DebugPanel {
IconButton::new("debug-restart", IconName::RotateCcw)
.icon_size(IconSize::Small)
.on_click(window.listener_for(
&running_state,
running_state,
|this, _, window, cx| {
this.rerun_session(window, cx);
},
@ -837,7 +837,7 @@ impl DebugPanel {
IconButton::new("debug-stop", IconName::Power)
.icon_size(IconSize::Small)
.on_click(window.listener_for(
&running_state,
running_state,
|this, _, _window, cx| {
if this.session().read(cx).is_building() {
this.session().update(cx, |session, cx| {
@ -892,7 +892,7 @@ impl DebugPanel {
)
.icon_size(IconSize::Small)
.on_click(window.listener_for(
&running_state,
running_state,
|this, _, _, cx| {
this.detach_client(cx);
},
@ -1160,7 +1160,7 @@ impl DebugPanel {
workspace
.project()
.read(cx)
.project_path_for_absolute_path(&path, cx)
.project_path_for_absolute_path(path, cx)
.context(
"Couldn't get project path for .zed/debug.json in active worktree",
)

View file

@ -413,7 +413,7 @@ impl NewProcessModal {
let Some(adapter) = self.debugger.as_ref() else {
return;
};
let scenario = self.debug_scenario(&adapter, cx);
let scenario = self.debug_scenario(adapter, cx);
cx.spawn_in(window, async move |this, cx| {
let scenario = scenario.await.context("no scenario to save")?;
let worktree_id = task_contexts
@ -659,12 +659,7 @@ impl Render for NewProcessModal {
this.mode = NewProcessMode::Attach;
if let Some(debugger) = this.debugger.as_ref() {
Self::update_attach_picker(
&this.attach_mode,
&debugger,
window,
cx,
);
Self::update_attach_picker(&this.attach_mode, debugger, window, cx);
}
this.mode_focus_handle(cx).focus(window);
cx.notify();
@ -1083,7 +1078,7 @@ impl DebugDelegate {
.into_iter()
.map(|(scenario, context)| {
let (kind, scenario) =
Self::get_scenario_kind(&languages, &dap_registry, scenario);
Self::get_scenario_kind(&languages, dap_registry, scenario);
(kind, scenario, Some(context))
})
.chain(
@ -1100,7 +1095,7 @@ impl DebugDelegate {
.filter(|(_, scenario)| valid_adapters.contains(&scenario.adapter))
.map(|(kind, scenario)| {
let (language, scenario) =
Self::get_scenario_kind(&languages, &dap_registry, scenario);
Self::get_scenario_kind(&languages, dap_registry, scenario);
(language.or(Some(kind)), scenario, None)
}),
)

View file

@ -341,7 +341,7 @@ impl SerializedPaneLayout {
pub(crate) fn in_order(&self) -> Vec<SerializedPaneLayout> {
let mut panes = vec![];
Self::inner_in_order(&self, &mut panes);
Self::inner_in_order(self, &mut panes);
panes
}

View file

@ -102,7 +102,7 @@ impl Render for RunningState {
.find(|pane| pane.read(cx).is_zoomed());
let active = self.panes.panes().into_iter().next();
let pane = if let Some(ref zoomed_pane) = zoomed_pane {
let pane = if let Some(zoomed_pane) = zoomed_pane {
zoomed_pane.update(cx, |pane, cx| pane.render(window, cx).into_any_element())
} else if let Some(active) = active {
self.panes
@ -627,7 +627,7 @@ impl RunningState {
if s.starts_with("\"$ZED_") && s.ends_with('"') {
*s = s[1..s.len() - 1].to_string();
}
if let Some(substituted) = substitute_variables_in_str(&s, context) {
if let Some(substituted) = substitute_variables_in_str(s, context) {
*s = substituted;
}
}
@ -657,7 +657,7 @@ impl RunningState {
}
resolve_path(s);
if let Some(substituted) = substitute_variables_in_str(&s, context) {
if let Some(substituted) = substitute_variables_in_str(s, context) {
*s = substituted;
}
}
@ -954,7 +954,7 @@ impl RunningState {
inventory.read(cx).task_template_by_label(
buffer,
worktree_id,
&label,
label,
cx,
)
})
@ -1310,7 +1310,7 @@ impl RunningState {
let mut pane_item_status = IndexMap::from_iter(
DebuggerPaneItem::all()
.iter()
.filter(|kind| kind.is_supported(&caps))
.filter(|kind| kind.is_supported(caps))
.map(|kind| (*kind, false)),
);
self.panes.panes().iter().for_each(|pane| {
@ -1371,7 +1371,7 @@ impl RunningState {
this.serialize_layout(window, cx);
match event {
Event::Remove { .. } => {
let _did_find_pane = this.panes.remove(&source_pane).is_ok();
let _did_find_pane = this.panes.remove(source_pane).is_ok();
debug_assert!(_did_find_pane);
cx.notify();
}

View file

@ -494,7 +494,7 @@ impl BreakpointList {
fn toggle_data_breakpoint(&mut self, id: &str, cx: &mut Context<Self>) {
if let Some(session) = &self.session {
session.update(cx, |this, cx| {
this.toggle_data_breakpoint(&id, cx);
this.toggle_data_breakpoint(id, cx);
});
}
}
@ -502,7 +502,7 @@ impl BreakpointList {
fn toggle_exception_breakpoint(&mut self, id: &str, cx: &mut Context<Self>) {
if let Some(session) = &self.session {
session.update(cx, |this, cx| {
this.toggle_exception_breakpoint(&id, cx);
this.toggle_exception_breakpoint(id, cx);
});
cx.notify();
const EXCEPTION_SERIALIZATION_INTERVAL: Duration = Duration::from_secs(1);

View file

@ -697,7 +697,7 @@ impl ConsoleQueryBarCompletionProvider {
new_bytes: &[u8],
snapshot: &TextBufferSnapshot,
) -> Range<Anchor> {
let buffer_offset = buffer_position.to_offset(&snapshot);
let buffer_offset = buffer_position.to_offset(snapshot);
let buffer_bytes = &buffer_text.as_bytes()[0..buffer_offset];
let mut prefix_len = 0;
@ -977,7 +977,7 @@ mod tests {
&cx.buffer_text(),
snapshot.anchor_before(buffer_position),
replacement.as_bytes(),
&snapshot,
snapshot,
);
cx.update_editor(|editor, _, cx| {

View file

@ -262,7 +262,7 @@ impl MemoryView {
cx: &mut Context<Self>,
) {
use parse_int::parse;
let Ok(as_address) = parse::<u64>(&memory_reference) else {
let Ok(as_address) = parse::<u64>(memory_reference) else {
return;
};
let access_size = evaluate_name
@ -931,7 +931,7 @@ impl Render for MemoryView {
v_flex()
.size_full()
.on_drag_move(cx.listener(|this, evt, _, _| {
this.handle_memory_drag(&evt);
this.handle_memory_drag(evt);
}))
.child(self.render_memory(cx).size_full())
.children(self.open_context_menu.as_ref().map(|(menu, position, _)| {

View file

@ -1289,7 +1289,7 @@ impl VariableList {
}),
)
.child(self.render_variable_value(
&entry,
entry,
&variable_color,
watcher.value.to_string(),
cx,
@ -1494,7 +1494,7 @@ impl VariableList {
}),
)
.child(self.render_variable_value(
&variable,
variable,
&variable_color,
dap.value.clone(),
cx,

View file

@ -139,7 +139,7 @@ async fn test_show_attach_modal_and_select_process(
workspace
.update(cx, |_, window, cx| {
let names =
attach_modal.update(cx, |modal, cx| attach_modal::_process_names(&modal, cx));
attach_modal.update(cx, |modal, cx| attach_modal::_process_names(modal, cx));
// Initially all processes are visible.
assert_eq!(3, names.len());
attach_modal.update(cx, |this, cx| {
@ -154,7 +154,7 @@ async fn test_show_attach_modal_and_select_process(
workspace
.update(cx, |_, _, cx| {
let names =
attach_modal.update(cx, |modal, cx| attach_modal::_process_names(&modal, cx));
attach_modal.update(cx, |modal, cx| attach_modal::_process_names(modal, cx));
// Initially all processes are visible.
assert_eq!(2, names.len());
})

View file

@ -107,7 +107,7 @@ async fn test_debug_session_substitutes_variables_and_relativizes_paths(
let expected_other_field = if input_path.contains("$ZED_WORKTREE_ROOT") {
input_path
.replace("$ZED_WORKTREE_ROOT", &path!("/test/worktree/path"))
.replace("$ZED_WORKTREE_ROOT", path!("/test/worktree/path"))
.to_owned()
} else {
input_path.to_string()