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
239 changed files with 854 additions and 1015 deletions
+1 -1
View File
@@ -441,7 +441,7 @@ impl<P: LinuxClient + 'static> Platform for P {
fn app_path(&self) -> Result<PathBuf> {
// get the path of the executable of the current process
let app_path = env::current_exe()?;
return Ok(app_path);
Ok(app_path)
}
fn set_menus(&self, menus: Vec<Menu>, _keymap: &Keymap) {
@@ -710,9 +710,7 @@ impl LinuxClient for WaylandClient {
fn set_cursor_style(&self, style: CursorStyle) {
let mut state = self.0.borrow_mut();
let need_update = state
.cursor_style
.map_or(true, |current_style| current_style != style);
let need_update = state.cursor_style != Some(style);
if need_update {
let serial = state.serial_tracker.get(SerialKind::MouseEnter);
@@ -1577,7 +1575,7 @@ impl Dispatch<wl_pointer::WlPointer, ()> for WaylandClientStatePtr {
if state
.keyboard_focused_window
.as_ref()
.map_or(false, |keyboard_window| window.ptr_eq(keyboard_window))
.is_some_and(|keyboard_window| window.ptr_eq(keyboard_window))
{
state.enter_token = None;
}
@@ -669,8 +669,8 @@ impl WaylandWindowStatePtr {
pub fn set_size_and_scale(&self, size: Option<Size<Pixels>>, scale: Option<f32>) {
let (size, scale) = {
let mut state = self.state.borrow_mut();
if size.map_or(true, |size| size == state.bounds.size)
&& scale.map_or(true, |scale| scale == state.scale)
if size.is_none_or(|size| size == state.bounds.size)
&& scale.is_none_or(|scale| scale == state.scale)
{
return;
}
+8 -8
View File
@@ -1586,11 +1586,11 @@ impl LinuxClient for X11Client {
fn read_from_primary(&self) -> Option<crate::ClipboardItem> {
let state = self.0.borrow_mut();
return state
state
.clipboard
.get_any(clipboard::ClipboardKind::Primary)
.context("X11: Failed to read from clipboard (primary)")
.log_with_level(log::Level::Debug);
.log_with_level(log::Level::Debug)
}
fn read_from_clipboard(&self) -> Option<crate::ClipboardItem> {
@@ -1603,11 +1603,11 @@ impl LinuxClient for X11Client {
{
return state.clipboard_item.clone();
}
return state
state
.clipboard
.get_any(clipboard::ClipboardKind::Clipboard)
.context("X11: Failed to read from clipboard (clipboard)")
.log_with_level(log::Level::Debug);
.log_with_level(log::Level::Debug)
}
fn run(&self) {
@@ -2010,12 +2010,12 @@ fn check_gtk_frame_extents_supported(
}
fn xdnd_is_atom_supported(atom: u32, atoms: &XcbAtoms) -> bool {
return atom == atoms.TEXT
atom == atoms.TEXT
|| atom == atoms.STRING
|| atom == atoms.UTF8_STRING
|| atom == atoms.TEXT_PLAIN
|| atom == atoms.TEXT_PLAIN_UTF8
|| atom == atoms.TextUriList;
|| atom == atoms.TextUriList
}
fn xdnd_get_supported_atom(
@@ -2043,7 +2043,7 @@ fn xdnd_get_supported_atom(
}
}
}
return 0;
0
}
fn xdnd_send_finished(
@@ -2144,7 +2144,7 @@ fn current_pointer_device_states(
if pointer_device_states.is_empty() {
log::error!("Found no xinput mouse pointers.");
}
return Some(pointer_device_states);
Some(pointer_device_states)
}
/// Returns true if the device is a pointer device. Does not include pointer device groups.
@@ -1078,11 +1078,11 @@ impl Clipboard {
} else {
String::from_utf8(result.bytes).map_err(|_| Error::ConversionFailure)?
};
return Ok(ClipboardItem::new_string(text));
Ok(ClipboardItem::new_string(text))
}
pub fn is_owner(&self, selection: ClipboardKind) -> bool {
return self.inner.is_owner(selection).unwrap_or(false);
self.inner.is_owner(selection).unwrap_or(false)
}
}
+1 -1
View File
@@ -104,7 +104,7 @@ fn bit_is_set_in_vec(bit_vec: &Vec<u32>, bit_index: u16) -> bool {
let array_index = bit_index as usize / 32;
bit_vec
.get(array_index)
.map_or(false, |bits| bit_is_set(*bits, bit_index % 32))
.is_some_and(|bits| bit_is_set(*bits, bit_index % 32))
}
fn bit_is_set(bits: u32, bit_index: u16) -> bool {