Fix a bunch of other low-hanging style lints (#36498)

- **Fix a bunch of low hanging style lints like unnecessary-return**
- **Fix single worktree violation**
- **And the rest**

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-08-19 21:26:17 +02:00 committed by GitHub
parent df9c2aefb1
commit 05fc0c432c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
239 changed files with 854 additions and 1015 deletions

View file

@ -553,7 +553,7 @@ impl KeymapEditor {
if exact_match {
keystrokes_match_exactly(&keystroke_query, keystrokes)
} else if keystroke_query.len() > keystrokes.len() {
return false;
false
} else {
for keystroke_offset in 0..keystrokes.len() {
let mut found_count = 0;
@ -568,12 +568,9 @@ impl KeymapEditor {
query.modifiers.is_subset_of(&keystroke.modifiers)
&& ((query.key.is_empty()
|| query.key == keystroke.key)
&& query
.key_char
.as_ref()
.map_or(true, |q_kc| {
q_kc == &keystroke.key
}));
&& query.key_char.as_ref().is_none_or(
|q_kc| q_kc == &keystroke.key,
));
if matches {
found_count += 1;
query_cursor += 1;
@ -585,7 +582,7 @@ impl KeymapEditor {
return true;
}
}
return false;
false
}
})
});
@ -2715,7 +2712,7 @@ impl ActionArgumentsEditor {
})
.ok();
}
return result;
result
})
.detach_and_log_err(cx);
Self {
@ -2818,7 +2815,7 @@ impl Render for ActionArgumentsEditor {
self.editor
.update(cx, |editor, _| editor.set_text_style_refinement(text_style));
return v_flex().w_full().child(
v_flex().w_full().child(
h_flex()
.min_h_8()
.min_w_48()
@ -2831,7 +2828,7 @@ impl Render for ActionArgumentsEditor {
.border_color(border_color)
.track_focus(&self.focus_handle)
.child(self.editor.clone()),
);
)
}
}
@ -2889,9 +2886,9 @@ impl CompletionProvider for KeyContextCompletionProvider {
_menu_is_open: bool,
_cx: &mut Context<Editor>,
) -> bool {
text.chars().last().map_or(false, |last_char| {
last_char.is_ascii_alphanumeric() || last_char == '_'
})
text.chars()
.last()
.is_some_and(|last_char| last_char.is_ascii_alphanumeric() || last_char == '_')
}
}
@ -2910,7 +2907,7 @@ async fn load_json_language(workspace: WeakEntity<Workspace>, cx: &mut AsyncApp)
Some(task) => task.await.context("Failed to load JSON language").log_err(),
None => None,
};
return json_language.unwrap_or_else(|| {
json_language.unwrap_or_else(|| {
Arc::new(Language::new(
LanguageConfig {
name: "JSON".into(),
@ -2918,7 +2915,7 @@ async fn load_json_language(workspace: WeakEntity<Workspace>, cx: &mut AsyncApp)
},
Some(tree_sitter_json::LANGUAGE.into()),
))
});
})
}
async fn load_keybind_context_language(
@ -2942,7 +2939,7 @@ async fn load_keybind_context_language(
.log_err(),
None => None,
};
return language.unwrap_or_else(|| {
language.unwrap_or_else(|| {
Arc::new(Language::new(
LanguageConfig {
name: "Zed Keybind Context".into(),
@ -2950,7 +2947,7 @@ async fn load_keybind_context_language(
},
Some(tree_sitter_rust::LANGUAGE.into()),
))
});
})
}
async fn save_keybinding_update(
@ -3130,7 +3127,7 @@ fn collect_contexts_from_assets() -> Vec<SharedString> {
let mut contexts = contexts.into_iter().collect::<Vec<_>>();
contexts.sort();
return contexts;
contexts
}
impl SerializableItem for KeymapEditor {

View file

@ -116,19 +116,19 @@ impl KeystrokeInput {
&& self
.keystrokes
.last()
.map_or(false, |last| last.key.is_empty())
.is_some_and(|last| last.key.is_empty())
{
return &self.keystrokes[..self.keystrokes.len() - 1];
}
return &self.keystrokes;
&self.keystrokes
}
fn dummy(modifiers: Modifiers) -> Keystroke {
return Keystroke {
Keystroke {
modifiers,
key: "".to_string(),
key_char: None,
};
}
}
fn keystrokes_changed(&self, cx: &mut Context<Self>) {
@ -182,7 +182,7 @@ impl KeystrokeInput {
fn end_close_keystrokes_capture(&mut self) -> Option<usize> {
self.close_keystrokes.take();
self.clear_close_keystrokes_timer.take();
return self.close_keystrokes_start.take();
self.close_keystrokes_start.take()
}
fn handle_possible_close_keystroke(
@ -233,7 +233,7 @@ impl KeystrokeInput {
return CloseKeystrokeResult::Partial;
}
self.end_close_keystrokes_capture();
return CloseKeystrokeResult::None;
CloseKeystrokeResult::None
}
fn on_modifiers_changed(
@ -437,7 +437,7 @@ impl KeystrokeInput {
// is a much more reliable check, as the intercept keystroke handlers are installed
// on focus of the inner focus handle, thereby ensuring our recording state does
// not get de-synced
return self.inner_focus_handle.is_focused(window);
self.inner_focus_handle.is_focused(window)
}
}
@ -934,7 +934,7 @@ mod tests {
let change_tracker = KeystrokeUpdateTracker::new(self.input.clone(), &mut self.cx);
let result = self.input.update_in(&mut self.cx, cb);
KeystrokeUpdateTracker::finish(change_tracker, &self.cx);
return result;
result
}
}

View file

@ -731,7 +731,7 @@ impl<const COLS: usize> ColumnWidths<COLS> {
}
widths[col_idx] = widths[col_idx] + (diff - diff_remaining);
return diff_remaining;
diff_remaining
}
}