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

@ -653,7 +653,7 @@ impl KeymapFile {
let is_only_binding = keymap.0[index]
.bindings
.as_ref()
.map_or(true, |bindings| bindings.len() == 1);
.is_none_or(|bindings| bindings.len() == 1);
let key_path: &[&str] = if is_only_binding {
&[]
} else {
@ -703,7 +703,7 @@ impl KeymapFile {
} else if keymap.0[index]
.bindings
.as_ref()
.map_or(true, |bindings| bindings.len() == 1)
.is_none_or(|bindings| bindings.len() == 1)
{
// if we are replacing the only binding in the section,
// just update the section in place, updating the context
@ -1056,10 +1056,10 @@ mod tests {
#[track_caller]
fn parse_keystrokes(keystrokes: &str) -> Vec<Keystroke> {
return keystrokes
keystrokes
.split(' ')
.map(|s| Keystroke::parse(s).expect("Keystrokes valid"))
.collect();
.collect()
}
#[test]

View file

@ -72,7 +72,7 @@ pub fn update_value_in_json_text<'a>(
}
} else if key_path
.last()
.map_or(false, |key| preserved_keys.contains(key))
.is_some_and(|key| preserved_keys.contains(key))
|| old_value != new_value
{
let mut new_value = new_value.clone();
@ -384,7 +384,7 @@ pub fn replace_top_level_array_value_in_json_text(
remove_range.start = cursor.node().range().start_byte;
}
}
return Ok((remove_range, String::new()));
Ok((remove_range, String::new()))
} else {
let (mut replace_range, mut replace_value) =
replace_value_in_json_text(value_str, key_path, tab_size, new_value, replace_key);
@ -405,7 +405,7 @@ pub fn replace_top_level_array_value_in_json_text(
}
}
return Ok((replace_range, replace_value));
Ok((replace_range, replace_value))
}
}
@ -527,7 +527,7 @@ pub fn append_top_level_array_value_in_json_text(
let descendant_index = cursor.descendant_index();
let res = cursor.goto_first_child() && cursor.node().kind() == kind;
cursor.goto_descendant(descendant_index);
return res;
res
}
}

View file

@ -1233,8 +1233,7 @@ impl SettingsStore {
// If a local settings file changed, then avoid recomputing local
// settings for any path outside of that directory.
if changed_local_path.map_or(
false,
if changed_local_path.is_some_and(
|(changed_root_id, changed_local_path)| {
*root_id != changed_root_id
|| !directory_path.starts_with(changed_local_path)