diff --git a/Cargo.toml b/Cargo.toml index 9e2fac41cf8..8a32c1c2713 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -172,6 +172,7 @@ large_include_file = "warn" large_stack_arrays = "warn" large_stack_frames = "warn" large_types_passed_by_value = "warn" +let_underscore_untyped = "warn" let_unit_value = "warn" linkedlist = "warn" lossy_float_literal = "warn" @@ -255,7 +256,6 @@ zero_sized_map_values = "warn" # TODO(emilk): enable more of these lints: iter_over_hash_type = "allow" -let_underscore_untyped = "allow" missing_assert_message = "allow" should_panic_without_expect = "allow" too_many_lines = "allow" diff --git a/crates/ecolor/src/hex_color_macro.rs b/crates/ecolor/src/hex_color_macro.rs index fd1075dc639..d6b131e6940 100644 --- a/crates/ecolor/src/hex_color_macro.rs +++ b/crates/ecolor/src/hex_color_macro.rs @@ -24,11 +24,11 @@ /// If the literal string has the wrong format, the code does not compile. /// /// ```compile_fail -/// let _ = ecolor::hex_color!("#abc"); +/// _ = ecolor::hex_color!("#abc"); /// ``` /// /// ```compile_fail -/// let _ = ecolor::hex_color!("#20212x"); +/// _ = ecolor::hex_color!("#20212x"); /// ``` /// /// The macro cannot be used in a `const` context. diff --git a/crates/eframe/src/web/web_runner.rs b/crates/eframe/src/web/web_runner.rs index a2793a13aeb..f68b59ae53d 100644 --- a/crates/eframe/src/web/web_runner.rs +++ b/crates/eframe/src/web/web_runner.rs @@ -213,7 +213,7 @@ impl WebRunner { // We can paint now, so clear the animation frame. // This drops the `closure` and allows another // animation frame to be scheduled - let _ = runner_ref.frame.take(); + _ = runner_ref.frame.take(); events::paint_and_schedule(&runner_ref) } }); diff --git a/crates/egui/src/lib.rs b/crates/egui/src/lib.rs index 29cd9ddcac8..43f7e6650a8 100644 --- a/crates/egui/src/lib.rs +++ b/crates/egui/src/lib.rs @@ -668,7 +668,7 @@ pub enum WidgetType { pub fn __run_test_ctx(mut run_ui: impl FnMut(&Context)) { let ctx = Context::default(); ctx.set_fonts(FontDefinitions::empty()); // prevent fonts from being loaded (save CPU time) - let _ = ctx.run(Default::default(), |ctx| { + _ = ctx.run(Default::default(), |ctx| { run_ui(ctx); }); } @@ -677,7 +677,7 @@ pub fn __run_test_ctx(mut run_ui: impl FnMut(&Context)) { pub fn __run_test_ui(add_contents: impl Fn(&mut Ui)) { let ctx = Context::default(); ctx.set_fonts(FontDefinitions::empty()); // prevent fonts from being loaded (save CPU time) - let _ = ctx.run(Default::default(), |ctx| { + _ = ctx.run(Default::default(), |ctx| { crate::CentralPanel::default().show(ctx, |ui| { add_contents(ui); }); diff --git a/crates/egui/src/load.rs b/crates/egui/src/load.rs index b6711de3c52..afcdcaaceae 100644 --- a/crates/egui/src/load.rs +++ b/crates/egui/src/load.rs @@ -303,7 +303,7 @@ pub trait BytesLoader { /// Implementations may use this to perform work at the end of a frame, /// such as evicting unused entries from a cache. fn end_pass(&self, frame_index: usize) { - let _ = frame_index; + _ = frame_index; } /// If the loader caches any data, this should return the size of that cache. @@ -370,7 +370,7 @@ pub trait ImageLoader { /// Implementations may use this to perform work at the end of a pass, /// such as evicting unused entries from a cache. fn end_pass(&self, frame_index: usize) { - let _ = frame_index; + _ = frame_index; } /// If the loader caches any data, this should return the size of that cache. @@ -508,7 +508,7 @@ pub trait TextureLoader { /// Implementations may use this to perform work at the end of a pass, /// such as evicting unused entries from a cache. fn end_pass(&self, frame_index: usize) { - let _ = frame_index; + _ = frame_index; } /// If the loader caches any data, this should return the size of that cache. diff --git a/crates/egui/src/response.rs b/crates/egui/src/response.rs index 6940a587589..64b37265798 100644 --- a/crates/egui/src/response.rs +++ b/crates/egui/src/response.rs @@ -1078,7 +1078,7 @@ impl Response { }); #[cfg(not(feature = "accesskit"))] { - let _ = id; + _ = id; } self diff --git a/crates/egui/src/viewport.rs b/crates/egui/src/viewport.rs index e685d3ee6b7..d9bab1f6fd2 100644 --- a/crates/egui/src/viewport.rs +++ b/crates/egui/src/viewport.rs @@ -1153,7 +1153,7 @@ impl ViewportOutput { self.parent = parent; self.class = class; - let _ = self.builder.patch(builder); // we ignore the returned command, because `self.builder` will be the basis of a new patch + _ = self.builder.patch(builder); // we ignore the returned command, because `self.builder` will be the basis of a new patch self.viewport_ui_cb = viewport_ui_cb; self.commands.append(&mut commands); self.repaint_delay = self.repaint_delay.min(repaint_delay); diff --git a/crates/egui/tests/accesskit.rs b/crates/egui/tests/accesskit.rs index bcc26d024b9..35f5d63aaa4 100644 --- a/crates/egui/tests/accesskit.rs +++ b/crates/egui/tests/accesskit.rs @@ -106,9 +106,9 @@ fn multiple_disabled_widgets() { let output = accesskit_output_single_egui_frame(|ctx| { CentralPanel::default().show(ctx, |ui| { ui.add_enabled_ui(false, |ui| { - let _ = ui.button("Button 1"); - let _ = ui.button("Button 2"); - let _ = ui.button("Button 3"); + _ = ui.button("Button 1"); + _ = ui.button("Button 2"); + _ = ui.button("Button 3"); }) }); }); diff --git a/crates/egui_demo_lib/benches/benchmark.rs b/crates/egui_demo_lib/benches/benchmark.rs index d3820603d5c..3072eaaaece 100644 --- a/crates/egui_demo_lib/benches/benchmark.rs +++ b/crates/egui_demo_lib/benches/benchmark.rs @@ -51,7 +51,7 @@ pub fn criterion_benchmark(c: &mut Criterion) { { let ctx = egui::Context::default(); - let _ = ctx.run(RawInput::default(), |ctx| { + _ = ctx.run(RawInput::default(), |ctx| { egui::CentralPanel::default().show(ctx, |ui| { c.bench_function("label &str", |b| { b.iter(|| { diff --git a/crates/egui_demo_lib/src/demo/about.rs b/crates/egui_demo_lib/src/demo/about.rs index 4a3bfd45683..2e3df3208ec 100644 --- a/crates/egui_demo_lib/src/demo/about.rs +++ b/crates/egui_demo_lib/src/demo/about.rs @@ -67,7 +67,7 @@ fn about_immediate_mode(ui: &mut egui::Ui) { ui.horizontal_wrapped(|ui| { ui.spacing_mut().item_spacing.x = 0.0; ui.label("Immediate mode is a GUI paradigm that lets you create a GUI with less code and simpler control flow. For example, this is how you create a "); - let _ = ui.small_button("button"); + _ = ui.small_button("button"); ui.label(" in egui:"); }); diff --git a/crates/egui_demo_lib/src/demo/context_menu.rs b/crates/egui_demo_lib/src/demo/context_menu.rs index 2dce3e76304..2076b1bef9d 100644 --- a/crates/egui_demo_lib/src/demo/context_menu.rs +++ b/crates/egui_demo_lib/src/demo/context_menu.rs @@ -50,28 +50,28 @@ impl ContextMenus { if ui.button("Open…").clicked() { ui.close_menu(); } - let _ = ui.button("Item"); + _ = ui.button("Item"); }); ui.menu_button("SubMenu", |ui| { if ui.button("Open…").clicked() { ui.close_menu(); } - let _ = ui.button("Item"); + _ = ui.button("Item"); }); - let _ = ui.button("Item"); + _ = ui.button("Item"); if ui.button("Open…").clicked() { ui.close_menu(); } }); ui.menu_button("SubMenu", |ui| { - let _ = ui.button("Item1"); - let _ = ui.button("Item2"); - let _ = ui.button("Item3"); - let _ = ui.button("Item4"); + _ = ui.button("Item1"); + _ = ui.button("Item2"); + _ = ui.button("Item3"); + _ = ui.button("Item4"); if ui.button("Open…").clicked() { ui.close_menu(); } }); - let _ = ui.button("Very long text for this item that should be wrapped"); + _ = ui.button("Very long text for this item that should be wrapped"); } } diff --git a/crates/egui_demo_lib/src/demo/misc_demo_window.rs b/crates/egui_demo_lib/src/demo/misc_demo_window.rs index 0fd6b7fb632..dd283fc23c8 100644 --- a/crates/egui_demo_lib/src/demo/misc_demo_window.rs +++ b/crates/egui_demo_lib/src/demo/misc_demo_window.rs @@ -217,7 +217,7 @@ fn label_ui(ui: &mut egui::Ui) { ); ui.label("You can mix in other widgets into text, like"); - let _ = ui.small_button("this button"); + _ = ui.small_button("this button"); ui.label("."); ui.label("The default font supports all latin and cyrillic characters (ИÅđ…), common math symbols (∫√∞²⅓…), and many emojis (💓🌟🖩…).") diff --git a/crates/egui_demo_lib/src/demo/tests/cursor_test.rs b/crates/egui_demo_lib/src/demo/tests/cursor_test.rs index 78214d5eb40..6c31d514cfe 100644 --- a/crates/egui_demo_lib/src/demo/tests/cursor_test.rs +++ b/crates/egui_demo_lib/src/demo/tests/cursor_test.rs @@ -19,7 +19,7 @@ impl crate::View for CursorTest { ui.vertical_centered_justified(|ui| { ui.heading("Hover to switch cursor icon:"); for &cursor_icon in &egui::CursorIcon::ALL { - let _ = ui + _ = ui .button(format!("{cursor_icon:?}")) .on_hover_cursor(cursor_icon); } diff --git a/crates/egui_demo_lib/src/demo/tests/id_test.rs b/crates/egui_demo_lib/src/demo/tests/id_test.rs index 6fd0e067aa0..de303da68d3 100644 --- a/crates/egui_demo_lib/src/demo/tests/id_test.rs +++ b/crates/egui_demo_lib/src/demo/tests/id_test.rs @@ -44,8 +44,8 @@ impl crate::View for IdTest { (and if it is, the window will have a new layout, and the slider will end up somewhere else, and so aborting the interaction probably makes sense)."); ui.label("So these buttons have automatic Id:s, and therefore there is no name clash:"); - let _ = ui.button("Button"); - let _ = ui.button("Button"); + _ = ui.button("Button"); + _ = ui.button("Button"); ui.vertical_centered(|ui| { ui.add(crate::egui_github_link_file!()); diff --git a/crates/egui_demo_lib/src/demo/tests/layout_test.rs b/crates/egui_demo_lib/src/demo/tests/layout_test.rs index f58369121b8..51ec2cdb796 100644 --- a/crates/egui_demo_lib/src/demo/tests/layout_test.rs +++ b/crates/egui_demo_lib/src/demo/tests/layout_test.rs @@ -180,5 +180,5 @@ fn demo_ui(ui: &mut Ui) { let mut dummy = false; ui.checkbox(&mut dummy, "checkbox"); ui.radio_value(&mut dummy, false, "radio"); - let _ = ui.button("button"); + _ = ui.button("button"); } diff --git a/crates/egui_extras/src/loaders.rs b/crates/egui_extras/src/loaders.rs index 02683e442e7..017ebc77f03 100644 --- a/crates/egui_extras/src/loaders.rs +++ b/crates/egui_extras/src/loaders.rs @@ -98,7 +98,7 @@ pub fn install_image_loaders(ctx: &egui::Context) { ))] log::warn!("`install_image_loaders` was called, but no loaders are enabled"); - let _ = ctx; + _ = ctx; } #[cfg(not(target_arch = "wasm32"))] diff --git a/crates/egui_extras/src/loaders/ehttp_loader.rs b/crates/egui_extras/src/loaders/ehttp_loader.rs index 79c776948c3..5a01865427d 100644 --- a/crates/egui_extras/src/loaders/ehttp_loader.rs +++ b/crates/egui_extras/src/loaders/ehttp_loader.rs @@ -105,7 +105,7 @@ impl BytesLoader for EhttpLoader { } fn forget(&self, uri: &str) { - let _ = self.cache.lock().remove(uri); + _ = self.cache.lock().remove(uri); } fn forget_all(&self) { diff --git a/crates/egui_extras/src/loaders/file_loader.rs b/crates/egui_extras/src/loaders/file_loader.rs index 5d1b45fb493..65ea7b1d412 100644 --- a/crates/egui_extras/src/loaders/file_loader.rs +++ b/crates/egui_extras/src/loaders/file_loader.rs @@ -108,7 +108,7 @@ impl BytesLoader for FileLoader { } fn forget(&self, uri: &str) { - let _ = self.cache.lock().remove(uri); + _ = self.cache.lock().remove(uri); } fn forget_all(&self) { diff --git a/crates/egui_extras/src/loaders/gif_loader.rs b/crates/egui_extras/src/loaders/gif_loader.rs index 1c20135150c..d31b963cd57 100644 --- a/crates/egui_extras/src/loaders/gif_loader.rs +++ b/crates/egui_extras/src/loaders/gif_loader.rs @@ -114,7 +114,7 @@ impl ImageLoader for GifLoader { } fn forget(&self, uri: &str) { - let _ = self.cache.lock().remove(uri); + _ = self.cache.lock().remove(uri); } fn forget_all(&self) { diff --git a/crates/egui_extras/src/loaders/image_loader.rs b/crates/egui_extras/src/loaders/image_loader.rs index 14086df935b..63137d26773 100644 --- a/crates/egui_extras/src/loaders/image_loader.rs +++ b/crates/egui_extras/src/loaders/image_loader.rs @@ -80,7 +80,7 @@ impl ImageLoader for ImageCrateLoader { } fn forget(&self, uri: &str) { - let _ = self.cache.lock().remove(uri); + _ = self.cache.lock().remove(uri); } fn forget_all(&self) { diff --git a/crates/epaint/src/mutex.rs b/crates/epaint/src/mutex.rs index 157701c2be0..4cbfdd47926 100644 --- a/crates/epaint/src/mutex.rs +++ b/crates/epaint/src/mutex.rs @@ -431,13 +431,13 @@ mod tests_rwlock { let other_thread1 = { let one = Arc::clone(&one); std::thread::spawn(move || { - let _ = one.write(); + _ = one.write(); }) }; let other_thread2 = { let one = Arc::clone(&one); std::thread::spawn(move || { - let _ = one.read(); + _ = one.read(); }) }; std::thread::sleep(Duration::from_millis(200)); diff --git a/examples/hello_world_par/src/main.rs b/examples/hello_world_par/src/main.rs index 7eeb7a2b6a3..a3f1d3be6e2 100644 --- a/examples/hello_world_par/src/main.rs +++ b/examples/hello_world_par/src/main.rs @@ -69,7 +69,7 @@ fn new_worker( let mut state = ThreadState::new(thread_nr); while let Ok(ctx) = show_rc.recv() { state.show(&ctx); - let _ = on_done_tx.send(()); + _ = on_done_tx.send(()); } }) .expect("failed to spawn thread"); @@ -124,11 +124,11 @@ impl eframe::App for MyApp { }); for (_handle, show_tx) in &self.threads { - let _ = show_tx.send(ctx.clone()); + _ = show_tx.send(ctx.clone()); } for _ in 0..self.threads.len() { - let _ = self.on_done_rc.recv(); + _ = self.on_done_rc.recv(); } } } diff --git a/tests/test_size_pass/src/main.rs b/tests/test_size_pass/src/main.rs index 6bb29330271..a158db67b81 100644 --- a/tests/test_size_pass/src/main.rs +++ b/tests/test_size_pass/src/main.rs @@ -45,7 +45,7 @@ fn main() -> eframe::Result { ); ui.label("Hover for interactive tooltip").on_hover_ui(|ui| { ui.label("This tooltip has a button:"); - let _ = ui.button("Clicking me does nothing"); + _ = ui.button("Clicking me does nothing"); }); }); }); @@ -64,9 +64,9 @@ fn main() -> eframe::Result { ui.label("The menu should be as wide as the widest button"); ui.menu_button("Click for menu", |ui| { - let _ = ui.button("Narrow").clicked(); - let _ = ui.button("Very wide text").clicked(); - let _ = ui.button("Narrow").clicked(); + _ = ui.button("Narrow").clicked(); + _ = ui.button("Very wide text").clicked(); + _ = ui.button("Narrow").clicked(); }); ui.label("Hover for tooltip").on_hover_ui(|ui| { diff --git a/tests/test_viewports/src/main.rs b/tests/test_viewports/src/main.rs index 9d06db431e4..d7ef255f060 100644 --- a/tests/test_viewports/src/main.rs +++ b/tests/test_viewports/src/main.rs @@ -12,7 +12,7 @@ pub const DRAG_AND_DROP_TEST: bool = false; fn main() { env_logger::init(); // Use `RUST_LOG=debug` to see logs. - let _ = eframe::run_native( + _ = eframe::run_native( "Viewports", eframe::NativeOptions { viewport: egui::ViewportBuilder::default().with_inner_size([450.0, 400.0]),