From 82704bebbf37d649e0ff35d89eff96ea9be3768d Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 6 Sep 2023 07:59:24 +0200 Subject: [PATCH] Update MSRV to Rust 1.70.0 (#3310) * Update to Rust 1.70 * Fix renamed clippy lint * Use let-else more * Code cleanup * Remove derelict Safety comments * Enable more clippy lints --- .github/workflows/rust.yml | 10 +++--- Cranky.toml | 37 +++++++++++++++++---- clippy.toml | 7 ++-- crates/ecolor/Cargo.toml | 2 +- crates/ecolor/src/rgba.rs | 2 +- crates/eframe/Cargo.toml | 2 +- crates/eframe/src/web/input.rs | 1 - crates/eframe/src/web/web_painter_wgpu.rs | 4 +-- crates/egui-wgpu/Cargo.toml | 2 +- crates/egui-wgpu/src/renderer.rs | 4 +-- crates/egui-wgpu/src/winit.rs | 6 ---- crates/egui-winit/Cargo.toml | 2 +- crates/egui-winit/src/clipboard.rs | 4 --- crates/egui-winit/src/lib.rs | 4 --- crates/egui-winit/src/window_settings.rs | 6 ++-- crates/egui/Cargo.toml | 2 +- crates/egui/src/memory.rs | 4 ++- crates/egui_demo_app/Cargo.toml | 2 +- crates/egui_demo_lib/Cargo.toml | 2 +- crates/egui_extras/Cargo.toml | 2 +- crates/egui_glium/Cargo.toml | 2 +- crates/egui_glow/Cargo.toml | 2 +- crates/egui_plot/Cargo.toml | 2 +- crates/egui_plot/src/axis.rs | 5 ++- crates/egui_plot/src/items/mod.rs | 1 + crates/emath/Cargo.toml | 2 +- crates/emath/src/rect.rs | 10 +++++- crates/epaint/Cargo.toml | 2 +- crates/epaint/src/stroke.rs | 2 +- crates/epaint/src/text/fonts.rs | 4 +-- crates/epaint/src/text/text_layout.rs | 5 ++- crates/epaint/src/text/text_layout_types.rs | 2 +- examples/confirm_exit/Cargo.toml | 2 +- examples/custom_3d_glow/Cargo.toml | 2 +- examples/custom_font/Cargo.toml | 2 +- examples/custom_font_style/Cargo.toml | 2 +- examples/custom_window_frame/Cargo.toml | 2 +- examples/download_image/Cargo.toml | 2 +- examples/file_dialog/Cargo.toml | 2 +- examples/hello_world/Cargo.toml | 2 +- examples/hello_world_par/Cargo.toml | 2 +- examples/hello_world_simple/Cargo.toml | 2 +- examples/keyboard_events/Cargo.toml | 2 +- examples/puffin_profiler/Cargo.toml | 2 +- examples/retained_image/Cargo.toml | 2 +- examples/save_plot/Cargo.toml | 2 +- examples/screenshot/Cargo.toml | 2 +- examples/serial_windows/Cargo.toml | 2 +- examples/svg/Cargo.toml | 2 +- examples/user_attention/Cargo.toml | 2 +- rust-toolchain | 2 +- scripts/clippy_wasm/clippy.toml | 7 ++-- 52 files changed, 102 insertions(+), 87 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 800ca242..471301af 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,7 +19,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.67.0 + toolchain: 1.70.0 - name: Install packages (Linux) if: runner.os == 'Linux' @@ -87,7 +87,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.67.0 + toolchain: 1.70.0 targets: wasm32-unknown-unknown - run: sudo apt-get update && sudo apt-get install libgtk-3-dev @@ -145,7 +145,7 @@ jobs: - uses: actions/checkout@v4 - uses: EmbarkStudios/cargo-deny-action@v1 with: - rust-version: "1.67.0" + rust-version: "1.70.0" log-level: error command: check arguments: --target ${{ matrix.target }} @@ -160,7 +160,7 @@ jobs: - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.67.0 + toolchain: 1.70.0 targets: aarch64-linux-android - name: Set up cargo cache @@ -178,7 +178,7 @@ jobs: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@master with: - toolchain: 1.67.0 + toolchain: 1.70.0 - name: Set up cargo cache uses: Swatinem/rust-cache@v2 diff --git a/Cranky.toml b/Cranky.toml index aaa2d8d6..d67d3e75 100644 --- a/Cranky.toml +++ b/Cranky.toml @@ -1,20 +1,30 @@ # https://github.com/ericseppanen/cargo-cranky # cargo install cargo-cranky && cargo cranky +# See also clippy.toml -deny = ["unsafe_code"] +deny = [ + "unsafe_code", + # Disabled waiting on https://github.com/rust-lang/rust-clippy/issues/9602 + #"clippy::self_named_module_files", +] warn = [ "clippy::all", + "clippy::as_ptr_cast_mut", "clippy::await_holding_lock", "clippy::bool_to_int_with_if", "clippy::char_lit_as_u8", "clippy::checked_conversions", + "clippy::clear_with_drain", "clippy::cloned_instead_of_copied", "clippy::dbg_macro", "clippy::debug_assert_with_mut_call", "clippy::derive_partial_eq_without_eq", - "clippy::disallowed_methods", - "clippy::disallowed_script_idents", + "clippy::disallowed_macros", # See clippy.toml + "clippy::disallowed_methods", # See clippy.toml + "clippy::disallowed_names", # See clippy.toml + "clippy::disallowed_script_idents", # See clippy.toml + "clippy::disallowed_types", # See clippy.toml "clippy::doc_link_with_quotes", "clippy::doc_markdown", "clippy::empty_enum", @@ -32,6 +42,7 @@ warn = [ "clippy::fn_params_excessive_bools", "clippy::fn_to_numeric_cast_any", "clippy::from_iter_instead_of_collect", + "clippy::get_unwrap", "clippy::if_let_mutex", "clippy::implicit_clone", "clippy::imprecise_flops", @@ -42,6 +53,7 @@ warn = [ "clippy::iter_on_empty_collections", "clippy::iter_on_single_items", "clippy::large_digit_groups", + "clippy::large_include_file", "clippy::large_stack_arrays", "clippy::large_types_passed_by_value", "clippy::let_unit_value", @@ -49,7 +61,9 @@ warn = [ "clippy::lossy_float_literal", "clippy::macro_use_imports", "clippy::manual_assert", + "clippy::manual_clamp", "clippy::manual_instant_elapsed", + "clippy::manual_let_else", "clippy::manual_ok_or", "clippy::manual_string_new", "clippy::map_err_ignore", @@ -81,17 +95,24 @@ warn = [ "clippy::rest_pat_in_fully_bound_structs", "clippy::same_functions_in_if_condition", "clippy::semicolon_if_nothing_returned", + "clippy::significant_drop_tightening", "clippy::single_match_else", "clippy::str_to_string", "clippy::string_add_assign", "clippy::string_add", "clippy::string_lit_as_bytes", "clippy::string_to_string", + "clippy::suspicious_command_arg_space", + "clippy::suspicious_xor_used_as_pow", "clippy::todo", "clippy::trailing_empty_array", "clippy::trait_duplication_in_bounds", + "clippy::unchecked_duration_subtraction", "clippy::unimplemented", "clippy::uninlined_format_args", + "clippy::unnecessary_box_returns", + "clippy::unnecessary_safety_doc", + "clippy::unnecessary_struct_initialization", "clippy::unnecessary_wraps", "clippy::unnested_or_patterns", "clippy::unused_peekable", @@ -99,6 +120,7 @@ warn = [ "clippy::unused_self", "clippy::useless_transmute", "clippy::verbose_file_reads", + "clippy::wildcard_dependencies", "clippy::zero_sized_map_values", "elided_lifetimes_in_paths", "future_incompatible", @@ -114,11 +136,14 @@ warn = [ ] allow = [ - "clippy::manual_range_contains", # This one is just annoying + "clippy::manual_range_contains", # this one is just worse imho - # Some of these we should try to put in "warn": - "clippy::type_complexity", + # TODO(emilk): enable more of these lints: + "clippy::let_underscore_untyped", + "clippy::missing_assert_message", "clippy::undocumented_unsafe_blocks", + "clippy::unwrap_used", + "clippy::wildcard_imports", "trivial_casts", "unsafe_op_in_unsafe_fn", # `unsafe_op_in_unsafe_fn` may become the default in future Rust versions: https://github.com/rust-lang/rust/issues/71668 "unused_qualifications", diff --git a/clippy.toml b/clippy.toml index 6dbb62aa..76f804a3 100644 --- a/clippy.toml +++ b/clippy.toml @@ -3,7 +3,7 @@ # ----------------------------------------------------------------------------- # Section identical to scripts/clippy_wasm/clippy.toml: -msrv = "1.67" +msrv = "1.70" allow-unwrap-in-tests = true @@ -14,9 +14,10 @@ avoid-breaking-exported-api = false max-fn-params-bools = 2 # TODO(emilk): decrease this to 1 # https://rust-lang.github.io/rust-clippy/master/index.html#/large_include_file -max-include-file-size = 100000 +max-include-file-size = 1000000 -too-many-lines-threshold = 100 +# https://rust-lang.github.io/rust-clippy/master/index.html#/type_complexity +type-complexity-threshold = 350 # ----------------------------------------------------------------------------- diff --git a/crates/ecolor/Cargo.toml b/crates/ecolor/Cargo.toml index ea2f895f..2e821516 100644 --- a/crates/ecolor/Cargo.toml +++ b/crates/ecolor/Cargo.toml @@ -7,7 +7,7 @@ authors = [ ] description = "Color structs and color conversion utilities" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" homepage = "https://github.com/emilk/egui" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/crates/ecolor/src/rgba.rs b/crates/ecolor/src/rgba.rs index f9d671fd..38bbaa32 100644 --- a/crates/ecolor/src/rgba.rs +++ b/crates/ecolor/src/rgba.rs @@ -38,7 +38,7 @@ pub(crate) fn f32_hash(state: &mut H, f: f32) { } } -#[allow(clippy::derive_hash_xor_eq)] +#[allow(clippy::derived_hash_with_manual_eq)] impl std::hash::Hash for Rgba { #[inline] fn hash(&self, state: &mut H) { diff --git a/crates/eframe/Cargo.toml b/crates/eframe/Cargo.toml index 70772f2f..619ae8e5 100644 --- a/crates/eframe/Cargo.toml +++ b/crates/eframe/Cargo.toml @@ -4,7 +4,7 @@ version = "0.22.0" authors = ["Emil Ernerfeldt "] description = "egui framework - write GUI apps that compiles to web and/or natively" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" homepage = "https://github.com/emilk/egui/tree/master/crates/eframe" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/crates/eframe/src/web/input.rs b/crates/eframe/src/web/input.rs index eacd1704..a32070c8 100644 --- a/crates/eframe/src/web/input.rs +++ b/crates/eframe/src/web/input.rs @@ -35,7 +35,6 @@ pub fn pos_from_touch_event( // search for the touch we previously used for the position // (unfortunately, `event.touches()` is not a rust collection): (0..event.touches().length()) - .into_iter() .map(|i| event.touches().get(i).unwrap()) .find(|touch| egui::TouchId::from(touch.identifier()) == *touch_id_for_pos) } else { diff --git a/crates/eframe/src/web/web_painter_wgpu.rs b/crates/eframe/src/web/web_painter_wgpu.rs index 83510dc4..8865574f 100644 --- a/crates/eframe/src/web/web_painter_wgpu.rs +++ b/crates/eframe/src/web/web_painter_wgpu.rs @@ -148,9 +148,7 @@ impl WebPainter for WebPainterWgpu { ) -> Result<(), JsValue> { let size_in_pixels = [self.canvas.width(), self.canvas.height()]; - let render_state = if let Some(render_state) = &self.render_state { - render_state - } else { + let Some(render_state) = &self.render_state else { return Err(JsValue::from_str( "Can't paint, wgpu renderer was already disposed", )); diff --git a/crates/egui-wgpu/Cargo.toml b/crates/egui-wgpu/Cargo.toml index 187b0561..22d54cb0 100644 --- a/crates/egui-wgpu/Cargo.toml +++ b/crates/egui-wgpu/Cargo.toml @@ -8,7 +8,7 @@ authors = [ "Emil Ernerfeldt ", ] edition = "2021" -rust-version = "1.67" +rust-version = "1.70" homepage = "https://github.com/emilk/egui/tree/master/crates/egui-wgpu" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/crates/egui-wgpu/src/renderer.rs b/crates/egui-wgpu/src/renderer.rs index f44b8d46..c97fba88 100644 --- a/crates/egui-wgpu/src/renderer.rs +++ b/crates/egui-wgpu/src/renderer.rs @@ -435,9 +435,7 @@ impl Renderer { } } Primitive::Callback(callback) => { - let cbfn = if let Some(c) = callback.callback.downcast_ref::() { - c - } else { + let Some(cbfn) = callback.callback.downcast_ref::() else { // We already warned in the `prepare` callback continue; }; diff --git a/crates/egui-wgpu/src/winit.rs b/crates/egui-wgpu/src/winit.rs index 171d5f08..00500af1 100644 --- a/crates/egui-wgpu/src/winit.rs +++ b/crates/egui-wgpu/src/winit.rs @@ -175,12 +175,6 @@ impl Painter { /// [`set_window`](Self::set_window) may be called with `Some(window)` as soon as you have a /// valid [`winit::window::Window`]. /// - /// # Safety - /// - /// The raw Window handle associated with the given `window` must be a valid object to create a - /// surface upon and must remain valid for the lifetime of the created surface. (The surface may - /// be cleared by passing `None`). - /// /// # Errors /// If the provided wgpu configuration does not match an available device. pub async fn set_window( diff --git a/crates/egui-winit/Cargo.toml b/crates/egui-winit/Cargo.toml index e7ec1a27..5f670007 100644 --- a/crates/egui-winit/Cargo.toml +++ b/crates/egui-winit/Cargo.toml @@ -4,7 +4,7 @@ version = "0.22.0" authors = ["Emil Ernerfeldt "] description = "Bindings for using egui with winit" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" homepage = "https://github.com/emilk/egui/tree/master/crates/egui-winit" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/crates/egui-winit/src/clipboard.rs b/crates/egui-winit/src/clipboard.rs index 71d913db..65d1636c 100644 --- a/crates/egui-winit/src/clipboard.rs +++ b/crates/egui-winit/src/clipboard.rs @@ -26,10 +26,6 @@ pub struct Clipboard { impl Clipboard { /// Construct a new instance - /// - /// # Safety - /// - /// The returned `Clipboard` must not outlive the input `_display_target`. pub fn new(_display_target: &dyn HasRawDisplayHandle) -> Self { Self { #[cfg(all(feature = "arboard", not(target_os = "android")))] diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index 62888588..8da31e2c 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -84,10 +84,6 @@ pub struct State { impl State { /// Construct a new instance - /// - /// # Safety - /// - /// The returned `State` must not outlive the input `display_target`. pub fn new(display_target: &dyn HasRawDisplayHandle) -> Self { let egui_input = egui::RawInput { focused: false, // winit will tell us when we have focus diff --git a/crates/egui-winit/src/window_settings.rs b/crates/egui-winit/src/window_settings.rs index 2b6f7bfa..985ac423 100644 --- a/crates/egui-winit/src/window_settings.rs +++ b/crates/egui-winit/src/window_settings.rs @@ -137,12 +137,10 @@ fn clamp_pos_to_monitors( let monitors = event_loop.available_monitors(); // default to primary monitor, in case the correct monitor was disconnected. - let mut active_monitor = if let Some(active_monitor) = event_loop + let Some(mut active_monitor) = event_loop .primary_monitor() .or_else(|| event_loop.available_monitors().next()) - { - active_monitor - } else { + else { return; // no monitors 🤷 }; diff --git a/crates/egui/Cargo.toml b/crates/egui/Cargo.toml index 2d184631..7ce890f4 100644 --- a/crates/egui/Cargo.toml +++ b/crates/egui/Cargo.toml @@ -4,7 +4,7 @@ version = "0.22.0" authors = ["Emil Ernerfeldt "] description = "An easy-to-use immediate mode GUI that runs on both web and native" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" homepage = "https://github.com/emilk/egui" license = "MIT OR Apache-2.0" readme = "../../README.md" diff --git a/crates/egui/src/memory.rs b/crates/egui/src/memory.rs index 0013ddf0..a997914e 100644 --- a/crates/egui/src/memory.rs +++ b/crates/egui/src/memory.rs @@ -449,7 +449,9 @@ impl Focus { } }); - let current_rect = *self.focus_widgets_cache.get(&focus_id).unwrap(); + let Some(current_rect) = self.focus_widgets_cache.get(&focus_id) else { + return None; + }; let mut best_score = std::f32::INFINITY; let mut best_id = None; diff --git a/crates/egui_demo_app/Cargo.toml b/crates/egui_demo_app/Cargo.toml index 2f6b185f..0a9a2814 100644 --- a/crates/egui_demo_app/Cargo.toml +++ b/crates/egui_demo_app/Cargo.toml @@ -4,7 +4,7 @@ version = "0.22.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false default-run = "egui_demo_app" diff --git a/crates/egui_demo_lib/Cargo.toml b/crates/egui_demo_lib/Cargo.toml index f643c0cb..961896e4 100644 --- a/crates/egui_demo_lib/Cargo.toml +++ b/crates/egui_demo_lib/Cargo.toml @@ -4,7 +4,7 @@ version = "0.22.0" authors = ["Emil Ernerfeldt "] description = "Example library for egui" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" homepage = "https://github.com/emilk/egui/tree/master/crates/egui_demo_lib" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/crates/egui_extras/Cargo.toml b/crates/egui_extras/Cargo.toml index 23583a22..7622d189 100644 --- a/crates/egui_extras/Cargo.toml +++ b/crates/egui_extras/Cargo.toml @@ -8,7 +8,7 @@ authors = [ ] description = "Extra functionality and widgets for the egui GUI library" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" homepage = "https://github.com/emilk/egui" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/crates/egui_glium/Cargo.toml b/crates/egui_glium/Cargo.toml index a4be314d..7a8f7587 100644 --- a/crates/egui_glium/Cargo.toml +++ b/crates/egui_glium/Cargo.toml @@ -4,7 +4,7 @@ version = "0.22.0" authors = ["Emil Ernerfeldt "] description = "Bindings for using egui natively using the glium library" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" homepage = "https://github.com/emilk/egui/tree/master/crates/egui_glium" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/crates/egui_glow/Cargo.toml b/crates/egui_glow/Cargo.toml index 1e611b98..d1e0d5af 100644 --- a/crates/egui_glow/Cargo.toml +++ b/crates/egui_glow/Cargo.toml @@ -4,7 +4,7 @@ version = "0.22.0" authors = ["Emil Ernerfeldt "] description = "Bindings for using egui natively using the glow library" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" homepage = "https://github.com/emilk/egui/tree/master/crates/egui_glow" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/crates/egui_plot/Cargo.toml b/crates/egui_plot/Cargo.toml index 152479db..53f35c42 100644 --- a/crates/egui_plot/Cargo.toml +++ b/crates/egui_plot/Cargo.toml @@ -8,7 +8,7 @@ authors = [ ] description = "Immediate mode plotting for the egui GUI library" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" homepage = "https://github.com/emilk/egui" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/crates/egui_plot/src/axis.rs b/crates/egui_plot/src/axis.rs index 93362270..efcd7cb0 100644 --- a/crates/egui_plot/src/axis.rs +++ b/crates/egui_plot/src/axis.rs @@ -255,9 +255,8 @@ impl AxisWidget { // --- add ticks --- let font_id = TextStyle::Body.resolve(ui.style()); - let transform = match self.transform { - Some(t) => t, - None => return response, + let Some(transform) = self.transform else { + return response; }; for step in self.steps.iter() { diff --git a/crates/egui_plot/src/items/mod.rs b/crates/egui_plot/src/items/mod.rs index e11a8947..820850f4 100644 --- a/crates/egui_plot/src/items/mod.rs +++ b/crates/egui_plot/src/items/mod.rs @@ -1,4 +1,5 @@ //! Contains items that can be added to a plot. +#![allow(clippy::type_complexity)] // TODO(emilk): simplify some of the callback types with type aliases use std::ops::RangeInclusive; diff --git a/crates/emath/Cargo.toml b/crates/emath/Cargo.toml index 70141c56..065b475a 100644 --- a/crates/emath/Cargo.toml +++ b/crates/emath/Cargo.toml @@ -4,7 +4,7 @@ version = "0.22.0" authors = ["Emil Ernerfeldt "] description = "Minimal 2D math library for GUI work" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" homepage = "https://github.com/emilk/egui/tree/master/crates/emath" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/crates/emath/src/rect.rs b/crates/emath/src/rect.rs index 0d5a1e8c..1007c219 100644 --- a/crates/emath/src/rect.rs +++ b/crates/emath/src/rect.rs @@ -360,9 +360,17 @@ impl Rect { /// Signed distance to the edge of the box. /// /// Negative inside the box. + /// + /// ``` + /// # use emath::{pos2, Rect}; + /// let rect = Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)); + /// assert_eq!(rect.signed_distance_to_pos(pos2(0.50, 0.50)), -0.50); + /// assert_eq!(rect.signed_distance_to_pos(pos2(0.75, 0.50)), -0.25); + /// assert_eq!(rect.signed_distance_to_pos(pos2(1.50, 0.50)), 0.50); + /// ``` pub fn signed_distance_to_pos(&self, pos: Pos2) -> f32 { let edge_distances = (pos - self.center()).abs() - self.size() * 0.5; - let inside_dist = edge_distances.x.max(edge_distances.y).min(0.0); + let inside_dist = edge_distances.max_elem().min(0.0); let outside_dist = edge_distances.max(Vec2::ZERO).length(); inside_dist + outside_dist } diff --git a/crates/epaint/Cargo.toml b/crates/epaint/Cargo.toml index 747c69b1..4da6195c 100644 --- a/crates/epaint/Cargo.toml +++ b/crates/epaint/Cargo.toml @@ -4,7 +4,7 @@ version = "0.22.0" authors = ["Emil Ernerfeldt "] description = "Minimal 2D graphics library for GUI work" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" homepage = "https://github.com/emilk/egui/tree/master/crates/epaint" license = "(MIT OR Apache-2.0) AND OFL-1.1 AND LicenseRef-UFL-1.0" # OFL and UFL used by default_fonts. See https://github.com/emilk/egui/issues/2321 readme = "README.md" diff --git a/crates/epaint/src/stroke.rs b/crates/epaint/src/stroke.rs index acfa4ef1..72f5a8cf 100644 --- a/crates/epaint/src/stroke.rs +++ b/crates/epaint/src/stroke.rs @@ -1,4 +1,4 @@ -#![allow(clippy::derive_hash_xor_eq)] // We need to impl Hash for f32, but we don't implement Eq, which is fine +#![allow(clippy::derived_hash_with_manual_eq)] // We need to impl Hash for f32, but we don't implement Eq, which is fine use super::*; diff --git a/crates/epaint/src/text/fonts.rs b/crates/epaint/src/text/fonts.rs index ab08fbe8..97f5e744 100644 --- a/crates/epaint/src/text/fonts.rs +++ b/crates/epaint/src/text/fonts.rs @@ -51,7 +51,7 @@ impl FontId { } } -#[allow(clippy::derive_hash_xor_eq)] +#[allow(clippy::derived_hash_with_manual_eq)] impl std::hash::Hash for FontId { #[inline(always)] fn hash(&self, state: &mut H) { @@ -552,7 +552,7 @@ impl FontsAndCache { #[derive(Clone, Copy, Debug, PartialEq)] struct HashableF32(f32); -#[allow(clippy::derive_hash_xor_eq)] +#[allow(clippy::derived_hash_with_manual_eq)] impl std::hash::Hash for HashableF32 { #[inline(always)] fn hash(&self, state: &mut H) { diff --git a/crates/epaint/src/text/text_layout.rs b/crates/epaint/src/text/text_layout.rs index 5586bfa9..4bd101bf 100644 --- a/crates/epaint/src/text/text_layout.rs +++ b/crates/epaint/src/text/text_layout.rs @@ -320,9 +320,8 @@ fn replace_last_glyph_with_overflow_character( job: &LayoutJob, row: &mut Row, ) { - let overflow_character = match job.wrap.overflow_character { - Some(c) => c, - None => return, + let Some(overflow_character) = job.wrap.overflow_character else { + return; }; loop { diff --git a/crates/epaint/src/text/text_layout_types.rs b/crates/epaint/src/text/text_layout_types.rs index 2cb7bb1d..12c625cc 100644 --- a/crates/epaint/src/text/text_layout_types.rs +++ b/crates/epaint/src/text/text_layout_types.rs @@ -1,4 +1,4 @@ -#![allow(clippy::derive_hash_xor_eq)] // We need to impl Hash for f32, but we don't implement Eq, which is fine +#![allow(clippy::derived_hash_with_manual_eq)] // We need to impl Hash for f32, but we don't implement Eq, which is fine #![allow(clippy::wrong_self_convention)] // We use `from_` to indicate conversion direction. It's non-diomatic, but makes sense in this context. use std::ops::Range; diff --git a/examples/confirm_exit/Cargo.toml b/examples/confirm_exit/Cargo.toml index 08144e7f..78b4f5bb 100644 --- a/examples/confirm_exit/Cargo.toml +++ b/examples/confirm_exit/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/custom_3d_glow/Cargo.toml b/examples/custom_3d_glow/Cargo.toml index c75ee3c4..7e249fed 100644 --- a/examples/custom_3d_glow/Cargo.toml +++ b/examples/custom_3d_glow/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/custom_font/Cargo.toml b/examples/custom_font/Cargo.toml index c7b212b5..b81691e2 100644 --- a/examples/custom_font/Cargo.toml +++ b/examples/custom_font/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/custom_font_style/Cargo.toml b/examples/custom_font_style/Cargo.toml index 3c5e9600..ad5efe3f 100644 --- a/examples/custom_font_style/Cargo.toml +++ b/examples/custom_font_style/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["tami5 "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/custom_window_frame/Cargo.toml b/examples/custom_window_frame/Cargo.toml index 448d8c2b..3a9a743f 100644 --- a/examples/custom_window_frame/Cargo.toml +++ b/examples/custom_window_frame/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/download_image/Cargo.toml b/examples/download_image/Cargo.toml index 5e4f28e1..055810e6 100644 --- a/examples/download_image/Cargo.toml +++ b/examples/download_image/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/file_dialog/Cargo.toml b/examples/file_dialog/Cargo.toml index 02045d62..7eac874e 100644 --- a/examples/file_dialog/Cargo.toml +++ b/examples/file_dialog/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index 580fe04e..b960dcfb 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/hello_world_par/Cargo.toml b/examples/hello_world_par/Cargo.toml index 76c1ac88..74d019ee 100644 --- a/examples/hello_world_par/Cargo.toml +++ b/examples/hello_world_par/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Maxim Osipenko "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/hello_world_simple/Cargo.toml b/examples/hello_world_simple/Cargo.toml index be399552..c4b26699 100644 --- a/examples/hello_world_simple/Cargo.toml +++ b/examples/hello_world_simple/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/keyboard_events/Cargo.toml b/examples/keyboard_events/Cargo.toml index 39a389f3..ae6276ab 100644 --- a/examples/keyboard_events/Cargo.toml +++ b/examples/keyboard_events/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Jose Palazon "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/puffin_profiler/Cargo.toml b/examples/puffin_profiler/Cargo.toml index 90baa1ac..334fb48f 100644 --- a/examples/puffin_profiler/Cargo.toml +++ b/examples/puffin_profiler/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/retained_image/Cargo.toml b/examples/retained_image/Cargo.toml index a1df1039..4f485897 100644 --- a/examples/retained_image/Cargo.toml +++ b/examples/retained_image/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/save_plot/Cargo.toml b/examples/save_plot/Cargo.toml index e2e2e83f..a8161d7f 100644 --- a/examples/save_plot/Cargo.toml +++ b/examples/save_plot/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["hacknus "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false [dependencies] diff --git a/examples/screenshot/Cargo.toml b/examples/screenshot/Cargo.toml index 3cc5887f..e6517be0 100644 --- a/examples/screenshot/Cargo.toml +++ b/examples/screenshot/Cargo.toml @@ -7,7 +7,7 @@ authors = [ ] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/serial_windows/Cargo.toml b/examples/serial_windows/Cargo.toml index 39f5a022..65e4efb3 100644 --- a/examples/serial_windows/Cargo.toml +++ b/examples/serial_windows/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/svg/Cargo.toml b/examples/svg/Cargo.toml index 219efd58..d461f687 100644 --- a/examples/svg/Cargo.toml +++ b/examples/svg/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false diff --git a/examples/user_attention/Cargo.toml b/examples/user_attention/Cargo.toml index 3a7e49a1..31b0afae 100644 --- a/examples/user_attention/Cargo.toml +++ b/examples/user_attention/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["TicClick "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.67" +rust-version = "1.70" publish = false [dependencies] diff --git a/rust-toolchain b/rust-toolchain index 5698c9e2..024d9db9 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -5,6 +5,6 @@ # to the user in the error, instead of "error: invalid channel name '[toolchain]'". [toolchain] -channel = "1.67.0" +channel = "1.70.0" components = [ "rustfmt", "clippy" ] targets = [ "wasm32-unknown-unknown" ] diff --git a/scripts/clippy_wasm/clippy.toml b/scripts/clippy_wasm/clippy.toml index 09359a06..309e1c42 100644 --- a/scripts/clippy_wasm/clippy.toml +++ b/scripts/clippy_wasm/clippy.toml @@ -6,7 +6,7 @@ # ----------------------------------------------------------------------------- # Section identical to the root clippy.toml: -msrv = "1.67" +msrv = "1.70" allow-unwrap-in-tests = true @@ -17,9 +17,10 @@ avoid-breaking-exported-api = false max-fn-params-bools = 2 # TODO(emilk): decrease this to 1 # https://rust-lang.github.io/rust-clippy/master/index.html#/large_include_file -max-include-file-size = 100000 +max-include-file-size = 1000000 -too-many-lines-threshold = 100 +# https://rust-lang.github.io/rust-clippy/master/index.html#/type_complexity +type-complexity-threshold = 350 # -----------------------------------------------------------------------------