lint: fix lints appearing in rust stable currently (#7118)

* [x] I have followed the instructions in the PR template
This commit is contained in:
Nicolas 2025-06-11 17:38:06 +02:00 committed by GitHub
parent cfb10a04f5
commit 9f9153805d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 26 additions and 26 deletions

View File

@ -45,7 +45,7 @@ pub fn storage_dir(app_id: &str) -> Option<PathBuf> {
#[expect(unsafe_code)] #[expect(unsafe_code)]
fn roaming_appdata() -> Option<PathBuf> { fn roaming_appdata() -> Option<PathBuf> {
use std::ffi::OsString; use std::ffi::OsString;
use std::os::windows::ffi::OsStringExt; use std::os::windows::ffi::OsStringExt as _;
use std::ptr; use std::ptr;
use std::slice; use std::slice;

View File

@ -1848,8 +1848,8 @@ pub fn short_device_event_description(event: &winit::event::DeviceEvent) -> &'st
use winit::event::DeviceEvent; use winit::event::DeviceEvent;
match event { match event {
DeviceEvent::Added { .. } => "DeviceEvent::Added", DeviceEvent::Added => "DeviceEvent::Added",
DeviceEvent::Removed { .. } => "DeviceEvent::Removed", DeviceEvent::Removed => "DeviceEvent::Removed",
DeviceEvent::MouseMotion { .. } => "DeviceEvent::MouseMotion", DeviceEvent::MouseMotion { .. } => "DeviceEvent::MouseMotion",
DeviceEvent::MouseWheel { .. } => "DeviceEvent::MouseWheel", DeviceEvent::MouseWheel { .. } => "DeviceEvent::MouseWheel",
DeviceEvent::Motion { .. } => "DeviceEvent::Motion", DeviceEvent::Motion { .. } => "DeviceEvent::Motion",
@ -1867,11 +1867,11 @@ pub fn short_window_event_description(event: &winit::event::WindowEvent) -> &'st
WindowEvent::ActivationTokenDone { .. } => "WindowEvent::ActivationTokenDone", WindowEvent::ActivationTokenDone { .. } => "WindowEvent::ActivationTokenDone",
WindowEvent::Resized { .. } => "WindowEvent::Resized", WindowEvent::Resized { .. } => "WindowEvent::Resized",
WindowEvent::Moved { .. } => "WindowEvent::Moved", WindowEvent::Moved { .. } => "WindowEvent::Moved",
WindowEvent::CloseRequested { .. } => "WindowEvent::CloseRequested", WindowEvent::CloseRequested => "WindowEvent::CloseRequested",
WindowEvent::Destroyed { .. } => "WindowEvent::Destroyed", WindowEvent::Destroyed => "WindowEvent::Destroyed",
WindowEvent::DroppedFile { .. } => "WindowEvent::DroppedFile", WindowEvent::DroppedFile { .. } => "WindowEvent::DroppedFile",
WindowEvent::HoveredFile { .. } => "WindowEvent::HoveredFile", WindowEvent::HoveredFile { .. } => "WindowEvent::HoveredFile",
WindowEvent::HoveredFileCancelled { .. } => "WindowEvent::HoveredFileCancelled", WindowEvent::HoveredFileCancelled => "WindowEvent::HoveredFileCancelled",
WindowEvent::Focused { .. } => "WindowEvent::Focused", WindowEvent::Focused { .. } => "WindowEvent::Focused",
WindowEvent::KeyboardInput { .. } => "WindowEvent::KeyboardInput", WindowEvent::KeyboardInput { .. } => "WindowEvent::KeyboardInput",
WindowEvent::ModifiersChanged { .. } => "WindowEvent::ModifiersChanged", WindowEvent::ModifiersChanged { .. } => "WindowEvent::ModifiersChanged",
@ -1882,7 +1882,7 @@ pub fn short_window_event_description(event: &winit::event::WindowEvent) -> &'st
WindowEvent::MouseWheel { .. } => "WindowEvent::MouseWheel", WindowEvent::MouseWheel { .. } => "WindowEvent::MouseWheel",
WindowEvent::MouseInput { .. } => "WindowEvent::MouseInput", WindowEvent::MouseInput { .. } => "WindowEvent::MouseInput",
WindowEvent::PinchGesture { .. } => "WindowEvent::PinchGesture", WindowEvent::PinchGesture { .. } => "WindowEvent::PinchGesture",
WindowEvent::RedrawRequested { .. } => "WindowEvent::RedrawRequested", WindowEvent::RedrawRequested => "WindowEvent::RedrawRequested",
WindowEvent::DoubleTapGesture { .. } => "WindowEvent::DoubleTapGesture", WindowEvent::DoubleTapGesture { .. } => "WindowEvent::DoubleTapGesture",
WindowEvent::RotationGesture { .. } => "WindowEvent::RotationGesture", WindowEvent::RotationGesture { .. } => "WindowEvent::RotationGesture",
WindowEvent::TouchpadPressure { .. } => "WindowEvent::TouchpadPressure", WindowEvent::TouchpadPressure { .. } => "WindowEvent::TouchpadPressure",

View File

@ -3511,9 +3511,10 @@ impl Context {
// Try most recently added loaders first (hence `.rev()`) // Try most recently added loaders first (hence `.rev()`)
for loader in bytes_loaders.iter().rev() { for loader in bytes_loaders.iter().rev() {
match loader.load(self, uri) { let result = loader.load(self, uri);
Err(load::LoadError::NotSupported) => continue, match result {
result => return result, Err(load::LoadError::NotSupported) => {}
_ => return result,
} }
} }
@ -3554,10 +3555,9 @@ impl Context {
// Try most recently added loaders first (hence `.rev()`) // Try most recently added loaders first (hence `.rev()`)
for loader in image_loaders.iter().rev() { for loader in image_loaders.iter().rev() {
match loader.load(self, uri, size_hint) { match loader.load(self, uri, size_hint) {
Err(load::LoadError::NotSupported) => continue, Err(load::LoadError::NotSupported) => {}
Err(load::LoadError::FormatNotSupported { detected_format }) => { Err(load::LoadError::FormatNotSupported { detected_format }) => {
format = format.or(detected_format); format = format.or(detected_format);
continue;
} }
result => return result, result => return result,
} }
@ -3600,7 +3600,7 @@ impl Context {
// Try most recently added loaders first (hence `.rev()`) // Try most recently added loaders first (hence `.rev()`)
for loader in texture_loaders.iter().rev() { for loader in texture_loaders.iter().rev() {
match loader.load(self, uri, texture_options, size_hint) { match loader.load(self, uri, texture_options, size_hint) {
Err(load::LoadError::NotSupported) => continue, Err(load::LoadError::NotSupported) => {}
result => return result, result => return result,
} }
} }

View File

@ -256,9 +256,7 @@ impl ViewportInfo {
/// If this is not the root viewport, /// If this is not the root viewport,
/// it is up to the user to hide this viewport the next frame. /// it is up to the user to hide this viewport the next frame.
pub fn close_requested(&self) -> bool { pub fn close_requested(&self) -> bool {
self.events self.events.contains(&ViewportEvent::Close)
.iter()
.any(|&event| event == ViewportEvent::Close)
} }
/// Helper: move [`Self::events`], clone the other fields. /// Helper: move [`Self::events`], clone the other fields.

View File

@ -739,7 +739,7 @@ impl WidgetInfo {
if text_value.is_empty() { if text_value.is_empty() {
"blank".into() "blank".into()
} else { } else {
text_value.to_string() text_value.clone()
} }
} else { } else {
"blank".into() "blank".into()

View File

@ -1235,7 +1235,7 @@ impl Areas {
self.visible_areas_current_frame.insert(layer_id); self.visible_areas_current_frame.insert(layer_id);
self.wants_to_be_on_top.insert(layer_id); self.wants_to_be_on_top.insert(layer_id);
if !self.order.iter().any(|x| *x == layer_id) { if !self.order.contains(&layer_id) {
self.order.push(layer_id); self.order.push(layer_id);
} }
} }
@ -1256,10 +1256,10 @@ impl Areas {
self.sublayers.entry(parent).or_default().insert(child); self.sublayers.entry(parent).or_default().insert(child);
// Make sure the layers are in the order list: // Make sure the layers are in the order list:
if !self.order.iter().any(|x| *x == parent) { if !self.order.contains(&parent) {
self.order.push(parent); self.order.push(parent);
} }
if !self.order.iter().any(|x| *x == child) { if !self.order.contains(&child) {
self.order.push(child); self.order.push(child);
} }
} }
@ -1268,7 +1268,7 @@ impl Areas {
self.order self.order
.iter() .iter()
.filter(|layer| layer.order == order && !self.is_sublayer(layer)) .filter(|layer| layer.order == order && !self.is_sublayer(layer))
.last() .next_back()
.copied() .copied()
} }

View File

@ -863,9 +863,11 @@ impl TextEdit<'_> {
fn mask_if_password(is_password: bool, text: &str) -> String { fn mask_if_password(is_password: bool, text: &str) -> String {
fn mask_password(text: &str) -> String { fn mask_password(text: &str) -> String {
std::iter::repeat(epaint::text::PASSWORD_REPLACEMENT_CHAR) std::iter::repeat_n(
.take(text.chars().count()) epaint::text::PASSWORD_REPLACEMENT_CHAR,
.collect::<String>() text.chars().count(),
)
.collect::<String>()
} }
if is_password { if is_password {

View File

@ -58,7 +58,7 @@ impl crate::View for Screenshot {
None None
} }
}) })
.last() .next_back()
}); });
if let Some(image) = image { if let Some(image) = image {

View File

@ -110,7 +110,7 @@ impl crate::View for GridTest {
ui.end_row(); ui.end_row();
let mut dyn_text = String::from("O"); let mut dyn_text = String::from("O");
dyn_text.extend(std::iter::repeat('h').take(self.text_length)); dyn_text.extend(std::iter::repeat_n('h', self.text_length));
ui.label(dyn_text); ui.label(dyn_text);
ui.label("Fifth row, second column"); ui.label("Fifth row, second column");
ui.end_row(); ui.end_row();