chore: Fix some violations of 'needless_pass_by_ref_mut' lint (#18795)

While this lint is allow-by-default, it seems pretty useful to get rid
of mutable borrows when they're not needed.

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-10-07 01:29:58 +02:00 committed by GitHub
parent 59f0f4ac42
commit 03c84466c2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 158 additions and 204 deletions

View file

@ -189,7 +189,7 @@ impl ThemeRegistry {
}
/// Removes all themes from the registry.
pub fn clear(&mut self) {
pub fn clear(&self) {
self.state.write().themes.clear();
}

View file

@ -498,7 +498,7 @@ pub fn observe_buffer_font_size_adjustment<V: 'static>(
}
/// Sets the adjusted buffer font size.
pub fn adjusted_font_size(size: Pixels, cx: &mut AppContext) -> Pixels {
pub fn adjusted_font_size(size: Pixels, cx: &AppContext) -> Pixels {
if let Some(AdjustedBufferFontSize(adjusted_size)) = cx.try_global::<AdjustedBufferFontSize>() {
let buffer_font_size = ThemeSettings::get_global(cx).buffer_font_size;
let delta = *adjusted_size - buffer_font_size;
@ -530,7 +530,7 @@ pub fn adjust_buffer_font_size(cx: &mut AppContext, f: fn(&mut Pixels)) {
}
/// Returns whether the buffer font size has been adjusted.
pub fn has_adjusted_buffer_font_size(cx: &mut AppContext) -> bool {
pub fn has_adjusted_buffer_font_size(cx: &AppContext) -> bool {
cx.has_global::<AdjustedBufferFontSize>()
}
@ -576,7 +576,7 @@ pub fn adjust_ui_font_size(cx: &mut AppContext, f: fn(&mut Pixels)) {
}
/// Returns whether the UI font size has been adjusted.
pub fn has_adjusted_ui_font_size(cx: &mut AppContext) -> bool {
pub fn has_adjusted_ui_font_size(cx: &AppContext) -> bool {
cx.has_global::<AdjustedUiFontSize>()
}