fix clippy warnings after new rust stable version

This commit is contained in:
Alexsander Falcucci 2026-04-17 19:36:42 +02:00
parent 04fcd7ac24
commit bfde1b9603
No known key found for this signature in database
GPG key ID: E2BCBE04A869DDF8
5 changed files with 56 additions and 41 deletions

View file

@ -264,13 +264,7 @@ impl Editor {
}
RedrawEvent::HighlightGroupSet { name, id } => {
tracy_zone!("EditorHighlightGroupSet");
#[cfg(target_os = "macos")]
if name.starts_with("MatchParen") {
self.register_match_paren_highlight_id(id);
}
#[cfg(not(target_os = "macos"))]
let _ = (name, id);
self.handle_highlight_group_set(name.as_str(), id);
}
RedrawEvent::CursorGoto { grid, column: left, row: top } => {
tracy_zone!("EditorCursorGoto");
@ -728,6 +722,16 @@ impl Editor {
self.reset_match_paren_cache_state();
}
#[cfg(target_os = "macos")]
fn handle_highlight_group_set(&mut self, name: &str, id: u64) {
if name.starts_with("MatchParen") {
self.register_match_paren_highlight_id(id);
}
}
#[cfg(not(target_os = "macos"))]
fn handle_highlight_group_set(&mut self, _name: &str, _id: u64) {}
#[cfg(target_os = "macos")]
fn grid_cell_text(&self, grid: u64, row: u64, column: u64) -> Option<String> {
self.windows.get(&grid).and_then(|window| {

View file

@ -211,7 +211,7 @@ pub fn group_windows(
for i in 0..windows.len() {
let _ = get_window_group(&mut windows, i);
}
windows.sort_by(|a, b| a.group.cmp(&b.group));
windows.sort_by_key(|a| a.group);
windows
.into_iter()
.chunk_by(|window| window.group)

View file

@ -166,6 +166,23 @@ impl RenderedWindow {
size
}
fn full_window_vertical_scroll_rows(
&self,
top: u64,
bottom: u64,
left: u64,
right: u64,
rows: i64,
cols: i64,
) -> Option<i64> {
(top == 0
&& bottom == u64::from(self.grid_size.height)
&& left == 0
&& right == u64::from(self.grid_size.width)
&& cols == 0)
.then_some(rows)
}
fn get_target_position(&self, grid_rect: &GridRect<f32>) -> GridPos<f32> {
let destination = self.grid_destination + grid_rect.min.to_vector();
@ -679,11 +696,8 @@ impl RenderedWindow {
}
WindowDrawCommand::Scroll { top, bottom, left, right, rows, cols } => {
tracy_zone!("scroll_cmd", 0);
if top == 0
&& bottom == u64::from(self.grid_size.height)
&& left == 0
&& right == u64::from(self.grid_size.width)
&& cols == 0
if let Some(rows) =
self.full_window_vertical_scroll_rows(top, bottom, left, right, rows, cols)
{
self.actual_lines.rotate(rows as isize);
}
@ -694,15 +708,16 @@ impl RenderedWindow {
self.scrollback_lines.iter_mut().for_each(|line| *line = None);
self.scroll_animation.reset();
}
WindowDrawCommand::Show if self.hidden => {
tracy_zone!("show_cmd", 0);
self.hidden = false;
self.position_t = 2.0; // We don't want to animate since the window is becoming visible,
// so we set t to 2.0 to stop animations.
self.grid_start_position = self.grid_destination;
self.scroll_animation.reset();
}
WindowDrawCommand::Show => {
tracy_zone!("show_cmd", 0);
if self.hidden {
self.hidden = false;
self.position_t = 2.0; // We don't want to animate since the window is becoming visible,
// so we set t to 2.0 to stop animations.
self.grid_start_position = self.grid_destination;
self.scroll_animation.reset();
}
}
WindowDrawCommand::Hide => {
tracy_zone!("hide_cmd", 0);

View file

@ -188,10 +188,10 @@ impl State {
self.paragraphs =
create_paragraphs(message, scale_factor as f32, &self.font_collection);
}
WindowEvent::KeyboardInput { event, is_synthetic: false, .. } => {
if self.handle_keyboard_input(event, message) {
self.skia_renderer.window().request_redraw();
}
WindowEvent::KeyboardInput { event, is_synthetic: false, .. }
if self.handle_keyboard_input(&event, message) =>
{
self.skia_renderer.window().request_redraw();
}
WindowEvent::MouseWheel { delta: MouseScrollDelta::LineDelta(_, y), .. } => {
self.mouse_scroll_accumulator += y * 3.0;
@ -231,7 +231,7 @@ impl State {
self.skia_renderer.swap_buffers();
}
fn handle_keyboard_input(&mut self, event: KeyEvent, message: &str) -> bool {
fn handle_keyboard_input(&mut self, event: &KeyEvent, message: &str) -> bool {
if event.state != ElementState::Pressed {
return false;
}
@ -300,7 +300,7 @@ impl State {
return true;
}
match event.logical_key {
match &event.logical_key {
// NOTE: These work regardless of the ctrl state, mimicking "less"
Key::Character(c) => match c.as_str() {
"k" => self.scroll_line(-1),

View file

@ -674,13 +674,11 @@ impl WinitWindowWrapper {
}
}
}
WindowSettingsChanged::MessageAreaDragSelection(enabled) => {
if !enabled {
for window_id in window_ids.iter() {
if let Some(route) = self.routes.get(window_id) {
route.window.mouse_manager.borrow_mut().clear_message_selection();
route.window.renderer.borrow_mut().set_message_selection(None);
}
WindowSettingsChanged::MessageAreaDragSelection(enabled) if !enabled => {
for window_id in window_ids.iter() {
if let Some(route) = self.routes.get(window_id) {
route.window.mouse_manager.borrow_mut().clear_message_selection();
route.window.renderer.borrow_mut().set_message_selection(None);
}
}
}
@ -724,14 +722,12 @@ impl WinitWindowWrapper {
}
#[cfg(target_os = "macos")]
WindowSettingsChanged::InputMacosAltIsMeta(enabled) => {
if enabled {
error_msg!(concat!(
"neovide_input_macos_alt_is_meta has now been removed. ",
"Use neovide_input_macos_option_key_is_meta instead. ",
"Please check https://neovide.dev/configuration.html#macos-option-key-is-meta for more information.",
));
}
WindowSettingsChanged::InputMacosAltIsMeta(enabled) if enabled => {
error_msg!(concat!(
"neovide_input_macos_alt_is_meta has now been removed. ",
"Use neovide_input_macos_option_key_is_meta instead. ",
"Please check https://neovide.dev/configuration.html#macos-option-key-is-meta for more information.",
));
}
#[cfg(target_os = "macos")]
WindowSettingsChanged::MacosSimpleFullscreen(fullscreen) => {