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
+3 -3
View File
@@ -2274,7 +2274,7 @@ impl Interactivity {
window.on_mouse_event(move |_: &MouseDownEvent, phase, window, _cx| {
if phase == DispatchPhase::Bubble && !window.default_prevented() {
let group_hovered = active_group_hitbox
.map_or(false, |group_hitbox_id| group_hitbox_id.is_hovered(window));
.is_some_and(|group_hitbox_id| group_hitbox_id.is_hovered(window));
let element_hovered = hitbox.is_hovered(window);
if group_hovered || element_hovered {
*active_state.borrow_mut() = ElementClickedState {
@@ -2614,7 +2614,7 @@ pub(crate) fn register_tooltip_mouse_handlers(
window.on_mouse_event({
let active_tooltip = active_tooltip.clone();
move |_: &MouseDownEvent, _phase, window: &mut Window, _cx| {
if !tooltip_id.map_or(false, |tooltip_id| tooltip_id.is_hovered(window)) {
if !tooltip_id.is_some_and(|tooltip_id| tooltip_id.is_hovered(window)) {
clear_active_tooltip_if_not_hoverable(&active_tooltip, window);
}
}
@@ -2623,7 +2623,7 @@ pub(crate) fn register_tooltip_mouse_handlers(
window.on_mouse_event({
let active_tooltip = active_tooltip.clone();
move |_: &ScrollWheelEvent, _phase, window: &mut Window, _cx| {
if !tooltip_id.map_or(false, |tooltip_id| tooltip_id.is_hovered(window)) {
if !tooltip_id.is_some_and(|tooltip_id| tooltip_id.is_hovered(window)) {
clear_active_tooltip_if_not_hoverable(&active_tooltip, window);
}
}
+1 -1
View File
@@ -64,7 +64,7 @@ mod any_image_cache {
cx: &mut App,
) -> Option<Result<Arc<RenderImage>, ImageCacheError>> {
let image_cache = image_cache.clone().downcast::<I>().unwrap();
return image_cache.update(cx, |image_cache, cx| image_cache.load(resource, window, cx));
image_cache.update(cx, |image_cache, cx| image_cache.load(resource, window, cx))
}
}
+4 -3
View File
@@ -938,9 +938,10 @@ impl Element for List {
let hitbox = window.insert_hitbox(bounds, HitboxBehavior::Normal);
// If the width of the list has changed, invalidate all cached item heights
if state.last_layout_bounds.map_or(true, |last_bounds| {
last_bounds.size.width != bounds.size.width
}) {
if state
.last_layout_bounds
.is_none_or(|last_bounds| last_bounds.size.width != bounds.size.width)
{
let new_items = SumTree::from_iter(
state.items.iter().map(|item| ListItem::Unmeasured {
focus_handle: item.focus_handle(),