From d7b618450cfd521cc320a05e5bbfec0bb5a29b5a Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 16 Nov 2022 18:16:13 +0100 Subject: [PATCH 1/4] Update to Rust 1.65 Because then you can use dynamic linking on Linux --- .github/workflows/rust.yml | 8 ++++---- CHANGELOG.md | 1 + crates/eframe/CHANGELOG.md | 1 + crates/eframe/Cargo.toml | 2 +- crates/egui-wgpu/Cargo.toml | 2 +- crates/egui-winit/Cargo.toml | 2 +- crates/egui/Cargo.toml | 2 +- crates/egui_demo_app/Cargo.toml | 25 ++++++++++--------------- crates/egui_demo_lib/Cargo.toml | 6 ++++-- crates/egui_extras/Cargo.toml | 6 ++++-- crates/egui_glium/Cargo.toml | 2 +- crates/egui_glow/Cargo.toml | 2 +- crates/emath/Cargo.toml | 2 +- crates/epaint/Cargo.toml | 2 +- examples/confirm_exit/Cargo.toml | 2 +- examples/custom_3d_glow/Cargo.toml | 2 +- examples/custom_3d_three-d/Cargo.toml | 6 +++--- 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/puffin_profiler/Cargo.toml | 2 +- examples/retained_image/Cargo.toml | 2 +- examples/screenshot/Cargo.toml | 2 +- examples/serial_windows/Cargo.toml | 2 +- examples/svg/Cargo.toml | 2 +- rust-toolchain | 2 +- 29 files changed, 49 insertions(+), 48 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 563a78ed5d8..e0ba2ffbb08 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,7 +19,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: default - toolchain: 1.64.0 + toolchain: 1.65.0 override: true - name: Install packages (Linux) if: runner.os == 'Linux' @@ -84,7 +84,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.64.0 + toolchain: 1.65.0 target: wasm32-unknown-unknown override: true @@ -136,7 +136,7 @@ jobs: - uses: actions/checkout@v2 - uses: EmbarkStudios/cargo-deny-action@v1 with: - rust-version: "1.62.0" + rust-version: "1.65.0" android: name: android @@ -146,7 +146,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.64.0 + toolchain: 1.65.0 target: aarch64-linux-android override: true - name: Set up cargo cache diff --git a/CHANGELOG.md b/CHANGELOG.md index c937bf010b2..d4293d9c678 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ NOTE: [`epaint`](crates/epaint/CHANGELOG.md), [`eframe`](crates/eframe/CHANGELOG ## Unreleased +* MSRV (Minimum Supported Rust Version) is now `1.65.0`. * ⚠️ BREAKING: egui now expects integrations to do all color blending in gamma space ([#2071](https://github.com/emilk/egui/pull/2071)). * ⚠️ BREAKING: if you have overlapping interactive widgets, only the top widget (last added) will be interactive ([#2244](https://github.com/emilk/egui/pull/2244)). diff --git a/crates/eframe/CHANGELOG.md b/crates/eframe/CHANGELOG.md index 31f81715dc1..07084df25a1 100644 --- a/crates/eframe/CHANGELOG.md +++ b/crates/eframe/CHANGELOG.md @@ -5,6 +5,7 @@ NOTE: [`egui-winit`](../egui-winit/CHANGELOG.md), [`egui_glium`](../egui_glium/C ## Unreleased +* MSRV (Minimum Supported Rust Version) is now `1.65.0`. * Added `NativeOptions::fullsize_content` option on Mac to build titlebar-less windows with floating window controls ([#2049](https://github.com/emilk/egui/pull/2049)). * Added `NativeOptions::event_loop_builder` hook for apps to change platform specific event loop options ([#1952](https://github.com/emilk/egui/pull/1952)). * Enabled deferred render state initialization to support Android ([#1952](https://github.com/emilk/egui/pull/1952)). diff --git a/crates/eframe/Cargo.toml b/crates/eframe/Cargo.toml index c4202f1936e..596e6d72edd 100644 --- a/crates/eframe/Cargo.toml +++ b/crates/eframe/Cargo.toml @@ -4,7 +4,7 @@ version = "0.19.0" authors = ["Emil Ernerfeldt "] description = "egui framework - write GUI apps that compiles to web and/or natively" edition = "2021" -rust-version = "1.62" +rust-version = "1.65" homepage = "https://github.com/emilk/egui/tree/master/crates/eframe" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/crates/egui-wgpu/Cargo.toml b/crates/egui-wgpu/Cargo.toml index dad6ce7aa37..31009aa330d 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.62" +rust-version = "1.65" 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-winit/Cargo.toml b/crates/egui-winit/Cargo.toml index 70cb6f52f9b..4667646c0ab 100644 --- a/crates/egui-winit/Cargo.toml +++ b/crates/egui-winit/Cargo.toml @@ -4,7 +4,7 @@ version = "0.19.0" authors = ["Emil Ernerfeldt "] description = "Bindings for using egui with winit" edition = "2021" -rust-version = "1.62" +rust-version = "1.65" 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/Cargo.toml b/crates/egui/Cargo.toml index cf13c969365..3e8e3ccce8c 100644 --- a/crates/egui/Cargo.toml +++ b/crates/egui/Cargo.toml @@ -4,7 +4,7 @@ version = "0.19.0" authors = ["Emil Ernerfeldt "] description = "An easy-to-use immediate mode GUI that runs on both web and native" edition = "2021" -rust-version = "1.62" +rust-version = "1.65" homepage = "https://github.com/emilk/egui" license = "MIT OR Apache-2.0" readme = "../../README.md" diff --git a/crates/egui_demo_app/Cargo.toml b/crates/egui_demo_app/Cargo.toml index 0a73c2e4351..e8bb5617dbb 100644 --- a/crates/egui_demo_app/Cargo.toml +++ b/crates/egui_demo_app/Cargo.toml @@ -4,7 +4,7 @@ version = "0.19.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.62" +rust-version = "1.65" publish = false default-run = "egui_demo_app" @@ -19,18 +19,9 @@ crate-type = ["cdylib", "rlib"] default = ["glow", "persistence"] http = ["ehttp", "image", "poll-promise", "egui_extras/image"] -persistence = [ - "eframe/persistence", - "egui/persistence", - "serde", -] -screen_reader = ["eframe/screen_reader"] # experimental -serde = [ - "dep:serde", - "egui_demo_lib/serde", - "egui_extras/serde", - "egui/serde", -] +persistence = ["eframe/persistence", "egui/persistence", "serde"] +screen_reader = ["eframe/screen_reader"] # experimental +serde = ["dep:serde", "egui_demo_lib/serde", "egui_extras/serde", "egui/serde"] syntax_highlighting = ["egui_demo_lib/syntax_highlighting"] glow = ["eframe/glow"] @@ -40,8 +31,12 @@ wgpu = ["eframe/wgpu", "bytemuck"] [dependencies] chrono = { version = "0.4", features = ["js-sys", "wasmbind"] } eframe = { version = "0.19.0", path = "../eframe", default-features = false } -egui = { version = "0.19.0", path = "../egui", features = ["extra_debug_asserts"] } -egui_demo_lib = { version = "0.19.0", path = "../egui_demo_lib", features = ["chrono"] } +egui = { version = "0.19.0", path = "../egui", features = [ + "extra_debug_asserts", +] } +egui_demo_lib = { version = "0.19.0", path = "../egui_demo_lib", features = [ + "chrono", +] } tracing = "0.1" # Optional dependencies: diff --git a/crates/egui_demo_lib/Cargo.toml b/crates/egui_demo_lib/Cargo.toml index 7a379630bad..07792422d94 100644 --- a/crates/egui_demo_lib/Cargo.toml +++ b/crates/egui_demo_lib/Cargo.toml @@ -4,7 +4,7 @@ version = "0.19.0" authors = ["Emil Ernerfeldt "] description = "Example library for egui" edition = "2021" -rust-version = "1.62" +rust-version = "1.65" homepage = "https://github.com/emilk/egui/tree/master/crates/egui_demo_lib" license = "MIT OR Apache-2.0" readme = "README.md" @@ -41,7 +41,9 @@ chrono = { version = "0.4", optional = true, features = ["js-sys", "wasmbind"] } ## Enable this when generating docs. document-features = { version = "0.2", optional = true } serde = { version = "1", optional = true, features = ["derive"] } -syntect = { version = "5", optional = true, default-features = false, features = ["default-fancy"] } +syntect = { version = "5", optional = true, default-features = false, features = [ + "default-fancy", +] } [dev-dependencies] diff --git a/crates/egui_extras/Cargo.toml b/crates/egui_extras/Cargo.toml index 83b8d082fd8..4926febcf5f 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.62" +rust-version = "1.65" homepage = "https://github.com/emilk/egui" license = "MIT OR Apache-2.0" readme = "README.md" @@ -67,4 +67,6 @@ usvg = { version = "0.23", optional = true } serde = { version = "1", features = ["derive"], optional = true } # feature "tracing" -tracing = { version = "0.1", optional = true, default-features = false, features = ["std"] } +tracing = { version = "0.1", optional = true, default-features = false, features = [ + "std", +] } diff --git a/crates/egui_glium/Cargo.toml b/crates/egui_glium/Cargo.toml index 62883542b1a..2aaa986c10f 100644 --- a/crates/egui_glium/Cargo.toml +++ b/crates/egui_glium/Cargo.toml @@ -4,7 +4,7 @@ version = "0.19.0" authors = ["Emil Ernerfeldt "] description = "Bindings for using egui natively using the glium library" edition = "2021" -rust-version = "1.62" +rust-version = "1.65" 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 fcda408d221..1f09feeb9f9 100644 --- a/crates/egui_glow/Cargo.toml +++ b/crates/egui_glow/Cargo.toml @@ -4,7 +4,7 @@ version = "0.19.0" authors = ["Emil Ernerfeldt "] description = "Bindings for using egui natively using the glow library" edition = "2021" -rust-version = "1.62" +rust-version = "1.65" homepage = "https://github.com/emilk/egui/tree/master/crates/egui_glow" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/crates/emath/Cargo.toml b/crates/emath/Cargo.toml index 4ca98c12081..9afc9a589be 100644 --- a/crates/emath/Cargo.toml +++ b/crates/emath/Cargo.toml @@ -4,7 +4,7 @@ version = "0.19.0" authors = ["Emil Ernerfeldt "] description = "Minimal 2D math library for GUI work" edition = "2021" -rust-version = "1.62" +rust-version = "1.65" homepage = "https://github.com/emilk/egui/tree/master/crates/emath" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/crates/epaint/Cargo.toml b/crates/epaint/Cargo.toml index b66527a51a8..c8c19648000 100644 --- a/crates/epaint/Cargo.toml +++ b/crates/epaint/Cargo.toml @@ -4,7 +4,7 @@ version = "0.19.0" authors = ["Emil Ernerfeldt "] description = "Minimal 2D graphics library for GUI work" edition = "2021" -rust-version = "1.62" +rust-version = "1.65" homepage = "https://github.com/emilk/egui/tree/master/crates/epaint" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/examples/confirm_exit/Cargo.toml b/examples/confirm_exit/Cargo.toml index 9346a3b3bfb..8393aae6028 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.62" +rust-version = "1.65" publish = false diff --git a/examples/custom_3d_glow/Cargo.toml b/examples/custom_3d_glow/Cargo.toml index afe8b9198a5..f124b901430 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.62" +rust-version = "1.65" publish = false diff --git a/examples/custom_3d_three-d/Cargo.toml b/examples/custom_3d_three-d/Cargo.toml index 4c6e662b7eb..9ce3f9fd78e 100644 --- a/examples/custom_3d_three-d/Cargo.toml +++ b/examples/custom_3d_three-d/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.62" +rust-version = "1.65" publish = false [lib] @@ -17,6 +17,6 @@ glow = "0.11" three-d = { version = "0.13", default-features = false } [target.'cfg(target_arch = "wasm32")'.dependencies] # Web dependencies -wasm-bindgen = "0.2" # Core bindings -wasm-bindgen-futures = "0.4" # Core bindings console_error_panic_hook = "0.1" # For logging +wasm-bindgen = "0.2" # Core bindings +wasm-bindgen-futures = "0.4" # Core bindings diff --git a/examples/custom_font/Cargo.toml b/examples/custom_font/Cargo.toml index 9b2637c1a74..29868ea23c6 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.62" +rust-version = "1.65" publish = false diff --git a/examples/custom_font_style/Cargo.toml b/examples/custom_font_style/Cargo.toml index c6f86a7e271..4db0565e0bc 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.62" +rust-version = "1.65" publish = false diff --git a/examples/custom_window_frame/Cargo.toml b/examples/custom_window_frame/Cargo.toml index 1c7f30d10b2..5f5ea2c603f 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.62" +rust-version = "1.65" publish = false diff --git a/examples/download_image/Cargo.toml b/examples/download_image/Cargo.toml index 88f03f4727d..87e0a8eb748 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.62" +rust-version = "1.65" publish = false diff --git a/examples/file_dialog/Cargo.toml b/examples/file_dialog/Cargo.toml index 6c3b005e3b4..6ac88b00e6c 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.62" +rust-version = "1.65" publish = false diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index 45570bc07d7..d0c07a05374 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.62" +rust-version = "1.65" publish = false diff --git a/examples/puffin_profiler/Cargo.toml b/examples/puffin_profiler/Cargo.toml index fefb311f160..d27c68eb062 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.62" +rust-version = "1.65" publish = false diff --git a/examples/retained_image/Cargo.toml b/examples/retained_image/Cargo.toml index 91742b366d6..d09bfae4f14 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.62" +rust-version = "1.65" publish = false diff --git a/examples/screenshot/Cargo.toml b/examples/screenshot/Cargo.toml index 3cdddbbeca8..3be923e6331 100644 --- a/examples/screenshot/Cargo.toml +++ b/examples/screenshot/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["René Rössler "] license = "MIT OR Apache-2.0" edition = "2021" -rust-version = "1.62" +rust-version = "1.65" publish = false diff --git a/examples/serial_windows/Cargo.toml b/examples/serial_windows/Cargo.toml index 48ac2cad74e..16a90ec7da8 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.62" +rust-version = "1.65" publish = false diff --git a/examples/svg/Cargo.toml b/examples/svg/Cargo.toml index 5c9cfdab94c..4bc9682d206 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.62" +rust-version = "1.65" publish = false diff --git a/rust-toolchain b/rust-toolchain index 89a258981d8..0e334035e4b 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.64.0" +channel = "1.65.0" components = [ "rustfmt", "clippy" ] targets = [ "wasm32-unknown-unknown" ] From d8617a66f6ea64fb0683a40ede48b14e738c7368 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 16 Nov 2022 18:33:00 +0100 Subject: [PATCH 2/4] Fix a bunch of clippy lints --- Cranky.toml | 215 ++++++++++--------- crates/eframe/src/native/epi_integration.rs | 4 +- crates/egui-wgpu/src/winit.rs | 2 +- crates/egui-winit/src/window_settings.rs | 2 +- crates/egui/src/memory.rs | 2 +- crates/egui/src/menu.rs | 4 +- crates/egui/src/widgets/drag_value.rs | 2 +- crates/egui/src/widgets/label.rs | 4 +- crates/egui/src/widgets/plot/items/mod.rs | 8 +- crates/egui/src/widgets/plot/items/values.rs | 2 +- crates/egui/src/widgets/plot/legend.rs | 2 +- crates/egui/src/widgets/text_edit/builder.rs | 10 +- crates/egui_demo_app/src/frame_history.rs | 2 +- crates/egui_extras/src/datepicker/button.rs | 4 +- crates/egui_extras/src/datepicker/popup.rs | 2 +- crates/epaint/src/mutex.rs | 6 +- examples/custom_3d_three-d/src/lib.rs | 2 + 17 files changed, 141 insertions(+), 132 deletions(-) diff --git a/Cranky.toml b/Cranky.toml index ce6c9e57d6b..28bb35fca4e 100644 --- a/Cranky.toml +++ b/Cranky.toml @@ -1,115 +1,122 @@ # https://github.com/ericseppanen/cargo-cranky # cargo install cargo-cranky && cargo cranky -deny = [ - "unsafe_code", -] +deny = ["unsafe_code"] warn = [ - "clippy::all", - "clippy::await_holding_lock", - "clippy::char_lit_as_u8", - "clippy::checked_conversions", - "clippy::dbg_macro", - "clippy::debug_assert_with_mut_call", - "clippy::disallowed_methods", - "clippy::disallowed_script_idents", - "clippy::doc_markdown", - "clippy::empty_enum", - "clippy::enum_glob_use", - "clippy::equatable_if_let", - "clippy::exit", - "clippy::expl_impl_clone_on_copy", - "clippy::explicit_deref_methods", - "clippy::explicit_into_iter_loop", - "clippy::explicit_iter_loop", - "clippy::fallible_impl_from", - "clippy::filter_map_next", - "clippy::flat_map_option", - "clippy::float_cmp_const", - "clippy::fn_params_excessive_bools", - "clippy::fn_to_numeric_cast_any", - "clippy::from_iter_instead_of_collect", - "clippy::if_let_mutex", - "clippy::implicit_clone", - "clippy::imprecise_flops", - "clippy::index_refutable_slice", - "clippy::inefficient_to_string", - "clippy::invalid_upcast_comparisons", - "clippy::iter_not_returning_iterator", - "clippy::large_digit_groups", - "clippy::large_stack_arrays", - "clippy::large_types_passed_by_value", - "clippy::let_unit_value", - "clippy::linkedlist", - "clippy::lossy_float_literal", - "clippy::macro_use_imports", - "clippy::manual_assert", - "clippy::manual_ok_or", - "clippy::map_err_ignore", - "clippy::map_flatten", - "clippy::map_unwrap_or", - "clippy::match_on_vec_items", - "clippy::match_same_arms", - "clippy::match_wild_err_arm", - "clippy::match_wildcard_for_single_variants", - "clippy::mem_forget", - "clippy::mismatched_target_os", - "clippy::missing_enforced_import_renames", - "clippy::missing_errors_doc", - "clippy::missing_safety_doc", - "clippy::mut_mut", - "clippy::mutex_integer", - "clippy::needless_borrow", - "clippy::needless_continue", - "clippy::needless_for_each", - "clippy::needless_pass_by_value", - "clippy::negative_feature_names", - "clippy::nonstandard_macro_braces", - "clippy::option_option", - "clippy::path_buf_push_overwrite", - "clippy::ptr_as_ptr", - "clippy::rc_mutex", - "clippy::ref_option_ref", - "clippy::rest_pat_in_fully_bound_structs", - "clippy::same_functions_in_if_condition", - "clippy::semicolon_if_nothing_returned", - "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::todo", - "clippy::trailing_empty_array", - "clippy::trait_duplication_in_bounds", - "clippy::unimplemented", - "clippy::unnecessary_wraps", - "clippy::unnested_or_patterns", - "clippy::unused_self", - "clippy::useless_transmute", - "clippy::verbose_file_reads", - "clippy::zero_sized_map_values", - "elided_lifetimes_in_paths", - "future_incompatible", - "nonstandard_style", - "rust_2018_idioms", - "rust_2021_prelude_collisions", - "rustdoc::missing_crate_level_docs", - "semicolon_in_expressions_from_macros", - "trivial_numeric_casts", - "unused_extern_crates", - "unused_import_braces", - "unused_lifetimes", - # "clippy::cloned_instead_of_copied", - # "clippy::mod_module_files", - # "trivial_casts", - # "unused_qualifications", + "clippy::all", + "clippy::await_holding_lock", + "clippy::bool_to_int_with_if", + "clippy::char_lit_as_u8", + "clippy::checked_conversions", + "clippy::dbg_macro", + "clippy::debug_assert_with_mut_call", + "clippy::disallowed_methods", + "clippy::disallowed_script_idents", + "clippy::doc_link_with_quotes", + "clippy::doc_markdown", + "clippy::empty_enum", + "clippy::enum_glob_use", + "clippy::equatable_if_let", + "clippy::exit", + "clippy::expl_impl_clone_on_copy", + "clippy::explicit_deref_methods", + "clippy::explicit_into_iter_loop", + "clippy::explicit_iter_loop", + "clippy::fallible_impl_from", + "clippy::filter_map_next", + "clippy::flat_map_option", + "clippy::float_cmp_const", + "clippy::fn_params_excessive_bools", + "clippy::fn_to_numeric_cast_any", + "clippy::from_iter_instead_of_collect", + "clippy::if_let_mutex", + "clippy::implicit_clone", + "clippy::imprecise_flops", + "clippy::index_refutable_slice", + "clippy::inefficient_to_string", + "clippy::invalid_upcast_comparisons", + "clippy::iter_not_returning_iterator", + "clippy::iter_on_empty_collections", + "clippy::iter_on_single_items", + "clippy::large_digit_groups", + "clippy::large_stack_arrays", + "clippy::large_types_passed_by_value", + "clippy::let_unit_value", + "clippy::linkedlist", + "clippy::lossy_float_literal", + "clippy::macro_use_imports", + "clippy::manual_assert", + "clippy::manual_instant_elapsed", + "clippy::manual_ok_or", + "clippy::manual_string_new", + "clippy::map_err_ignore", + "clippy::map_flatten", + "clippy::map_unwrap_or", + "clippy::match_on_vec_items", + "clippy::match_same_arms", + "clippy::match_wild_err_arm", + "clippy::match_wildcard_for_single_variants", + "clippy::mem_forget", + "clippy::mismatched_target_os", + "clippy::mismatching_type_param_order", + "clippy::missing_enforced_import_renames", + "clippy::missing_errors_doc", + "clippy::missing_safety_doc", + "clippy::mut_mut", + "clippy::mutex_integer", + "clippy::needless_borrow", + "clippy::needless_continue", + "clippy::needless_for_each", + "clippy::needless_pass_by_value", + "clippy::negative_feature_names", + "clippy::nonstandard_macro_braces", + "clippy::option_option", + "clippy::path_buf_push_overwrite", + "clippy::ptr_as_ptr", + "clippy::rc_mutex", + "clippy::ref_option_ref", + "clippy::rest_pat_in_fully_bound_structs", + "clippy::same_functions_in_if_condition", + "clippy::semicolon_if_nothing_returned", + "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::todo", + "clippy::trailing_empty_array", + "clippy::trait_duplication_in_bounds", + "clippy::unimplemented", + "clippy::unnecessary_wraps", + "clippy::unnested_or_patterns", + "clippy::unused_peekable", + "clippy::unused_rounding", + "clippy::unused_self", + "clippy::useless_transmute", + "clippy::verbose_file_reads", + "clippy::zero_sized_map_values", + "elided_lifetimes_in_paths", + "future_incompatible", + "nonstandard_style", + "rust_2018_idioms", + "rust_2021_prelude_collisions", + "rustdoc::missing_crate_level_docs", + "semicolon_in_expressions_from_macros", + "trivial_numeric_casts", + "unused_extern_crates", + "unused_import_braces", + "unused_lifetimes", ] allow = [ + # TODO(emilk): enable more lints + "clippy::cloned_instead_of_copied", "clippy::derive_partial_eq_without_eq", "clippy::type_complexity", - "clippy::unnecessary_lazy_evaluations", - "clippy::let-and-return" + "clippy::undocumented_unsafe_blocks", + "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/crates/eframe/src/native/epi_integration.rs b/crates/eframe/src/native/epi_integration.rs index a27cb738caa..2d75d998818 100644 --- a/crates/eframe/src/native/epi_integration.rs +++ b/crates/eframe/src/native/epi_integration.rs @@ -165,7 +165,7 @@ pub fn handle_app_output( } if let Some(fullscreen) = fullscreen { - window.set_fullscreen(fullscreen.then(|| winit::window::Fullscreen::Borderless(None))); + window.set_fullscreen(fullscreen.then_some(winit::window::Fullscreen::Borderless(None))); } if let Some(window_title) = window_title { @@ -328,7 +328,7 @@ impl EpiIntegration { handle_app_output(window, self.egui_ctx.pixels_per_point(), app_output); } - let frame_time = (std::time::Instant::now() - frame_start).as_secs_f64() as f32; + let frame_time = frame_start.elapsed().as_secs_f64() as f32; self.frame.info.cpu_usage = Some(frame_time); full_output diff --git a/crates/egui-wgpu/src/winit.rs b/crates/egui-wgpu/src/winit.rs index 8eb788dcf86..707f24f706b 100644 --- a/crates/egui-wgpu/src/winit.rs +++ b/crates/egui-wgpu/src/winit.rs @@ -46,7 +46,7 @@ impl Painter { Self { configuration, msaa_samples, - depth_format: (depth_bits > 0).then(|| wgpu::TextureFormat::Depth32Float), + depth_format: (depth_bits > 0).then_some(wgpu::TextureFormat::Depth32Float), depth_texture_view: None, instance, diff --git a/crates/egui-winit/src/window_settings.rs b/crates/egui-winit/src/window_settings.rs index 78aeace0706..104d9041219 100644 --- a/crates/egui-winit/src/window_settings.rs +++ b/crates/egui-winit/src/window_settings.rs @@ -68,7 +68,7 @@ impl WindowSettings { }) .with_fullscreen( self.fullscreen - .then(|| winit::window::Fullscreen::Borderless(None)), + .then_some(winit::window::Fullscreen::Borderless(None)), ) } else { window diff --git a/crates/egui/src/memory.rs b/crates/egui/src/memory.rs index a588bf87ead..1d94601b413 100644 --- a/crates/egui/src/memory.rs +++ b/crates/egui/src/memory.rs @@ -293,7 +293,7 @@ impl Focus { self.id_next_frame = self.last_interested; // frame-delay so gained_focus works self.pressed_shift_tab = false; } - } else if self.pressed_tab && self.id == None && !self.give_to_next { + } else if self.pressed_tab && self.id.is_none() && !self.give_to_next { // nothing has focus and the user pressed tab - give focus to the first widgets that wants it: self.id = Some(id); self.pressed_tab = false; diff --git a/crates/egui/src/menu.rs b/crates/egui/src/menu.rs index 2c50c1926db..db32d14cd68 100644 --- a/crates/egui/src/menu.rs +++ b/crates/egui/src/menu.rs @@ -443,7 +443,7 @@ impl SubMenuButton { let (rect, response) = ui.allocate_at_least(desired_size, sense); response.widget_info(|| { - crate::WidgetInfo::labeled(crate::WidgetType::Button, &text_galley.text()) + crate::WidgetInfo::labeled(crate::WidgetType::Button, text_galley.text()) }); if ui.is_rect_visible(rect) { @@ -491,7 +491,7 @@ impl SubMenu { add_contents: impl FnOnce(&mut Ui) -> R, ) -> InnerResponse> { let sub_id = ui.id().with(self.button.index); - let button = self.button.show(ui, &*self.parent_state.read(), sub_id); + let button = self.button.show(ui, &self.parent_state.read(), sub_id); self.parent_state .write() .submenu_button_interaction(ui, sub_id, &button); diff --git a/crates/egui/src/widgets/drag_value.rs b/crates/egui/src/widgets/drag_value.rs index d750041f8e8..55ea13e9970 100644 --- a/crates/egui/src/widgets/drag_value.rs +++ b/crates/egui/src/widgets/drag_value.rs @@ -464,7 +464,7 @@ impl<'a> Widget for DragValue<'a> { // Since we round the value being dragged, we need to store the full precision value in memory: let stored_value = (drag_state.last_dragged_id == Some(response.id)) - .then(|| drag_state.last_dragged_value) + .then_some(drag_state.last_dragged_value) .flatten(); let stored_value = stored_value.unwrap_or(value); let stored_value = stored_value + delta_value; diff --git a/crates/egui/src/widgets/label.rs b/crates/egui/src/widgets/label.rs index 3bf9f628f3b..153a119f478 100644 --- a/crates/egui/src/widgets/label.rs +++ b/crates/egui/src/widgets/label.rs @@ -110,7 +110,7 @@ impl Label { if let Some(first_section) = text_job.job.sections.first_mut() { first_section.leading_space = first_row_indentation; } - let text_galley = text_job.into_galley(&*ui.fonts()); + let text_galley = text_job.into_galley(&ui.fonts()); let pos = pos2(ui.max_rect().left(), ui.cursor().top()); assert!( @@ -143,7 +143,7 @@ impl Label { text_job.job.justify = ui.layout().horizontal_justify(); }; - let text_galley = text_job.into_galley(&*ui.fonts()); + let text_galley = text_job.into_galley(&ui.fonts()); let (rect, response) = ui.allocate_exact_size(text_galley.size(), self.sense); let pos = match text_galley.galley.job.halign { Align::LEFT => rect.left_top(), diff --git a/crates/egui/src/widgets/plot/items/mod.rs b/crates/egui/src/widgets/plot/items/mod.rs index 6e106bf3708..aa24e60ab3e 100644 --- a/crates/egui/src/widgets/plot/items/mod.rs +++ b/crates/egui/src/widgets/plot/items/mod.rs @@ -406,7 +406,7 @@ impl Line { /// a horizontal line at the given y-coordinate. fn y_intersection(p1: &Pos2, p2: &Pos2, y: f32) -> Option { ((p1.y > y && p2.y < y) || (p1.y < y && p2.y > y)) - .then(|| ((y * (p1.x - p2.x)) - (p1.x * p2.y - p1.y * p2.x)) / (p1.y - p2.y)) + .then_some(((y * (p1.x - p2.x)) - (p1.x * p2.y - p1.y * p2.x)) / (p1.y - p2.y)) } impl PlotItem for Line { @@ -844,7 +844,7 @@ impl PlotItem for Points { let default_stroke = Stroke::new(stroke_size, *color); let mut stem_stroke = default_stroke; let stroke = (!filled) - .then(|| default_stroke) + .then_some(default_stroke) .unwrap_or_else(Stroke::none); let fill = filled.then(|| *color).unwrap_or_default(); @@ -1644,7 +1644,7 @@ fn add_rulers_and_text( let corner_value = elem.corner_value(); shapes.push(Shape::text( - &*plot.ui.fonts(), + &plot.ui.fonts(), plot.transform.position_from_point(&corner_value) + vec2(3.0, -2.0), Align2::LEFT_BOTTOM, text, @@ -1701,7 +1701,7 @@ pub(super) fn rulers_at_value( let font_id = TextStyle::Body.resolve(plot.ui.style()); shapes.push(Shape::text( - &*plot.ui.fonts(), + &plot.ui.fonts(), pointer + vec2(3.0, -2.0), Align2::LEFT_BOTTOM, text, diff --git a/crates/egui/src/widgets/plot/items/values.rs b/crates/egui/src/widgets/plot/items/values.rs index d39947d1874..739490dcf27 100644 --- a/crates/egui/src/widgets/plot/items/values.rs +++ b/crates/egui/src/widgets/plot/items/values.rs @@ -299,7 +299,7 @@ impl PlotPoints { ) -> Option> { let start = range1.start().max(*range2.start()); let end = range1.end().min(*range2.end()); - (start < end).then(|| start..=end) + (start < end).then_some(start..=end) } pub(super) fn bounds(&self) -> PlotBounds { diff --git a/crates/egui/src/widgets/plot/legend.rs b/crates/egui/src/widgets/plot/legend.rs index a0a8ad991e2..216f14b9ea9 100644 --- a/crates/egui/src/widgets/plot/legend.rs +++ b/crates/egui/src/widgets/plot/legend.rs @@ -189,7 +189,7 @@ impl LegendWidget { LegendEntry::new(color, checked) }); }); - (!entries.is_empty()).then(|| Self { + (!entries.is_empty()).then_some(Self { rect, entries, config, diff --git a/crates/egui/src/widgets/text_edit/builder.rs b/crates/egui/src/widgets/text_edit/builder.rs index 6d83389c577..11cd7be12d1 100644 --- a/crates/egui/src/widgets/text_edit/builder.rs +++ b/crates/egui/src/widgets/text_edit/builder.rs @@ -490,7 +490,7 @@ impl<'t> TextEdit<'t> { if response.hovered() && ui.input().pointer.any_pressed() { ui.memory().request_focus(id); if ui.input().modifiers.shift { - if let Some(mut cursor_range) = state.cursor_range(&*galley) { + if let Some(mut cursor_range) = state.cursor_range(&galley) { cursor_range.primary = cursor_at_pointer; state.set_cursor_range(Some(cursor_range)); } else { @@ -502,7 +502,7 @@ impl<'t> TextEdit<'t> { } else if ui.input().pointer.any_down() && response.is_pointer_button_down_on() { // drag to select text: - if let Some(mut cursor_range) = state.cursor_range(&*galley) { + if let Some(mut cursor_range) = state.cursor_range(&galley) { cursor_range.primary = cursor_at_pointer; state.set_cursor_range(Some(cursor_range)); } @@ -516,7 +516,7 @@ impl<'t> TextEdit<'t> { } let mut cursor_range = None; - let prev_cursor_range = state.cursor_range(&*galley); + let prev_cursor_range = state.cursor_range(&galley); if ui.memory().has_focus(id) && interactive { ui.memory().lock_focus(id, lock_focus); @@ -595,7 +595,7 @@ impl<'t> TextEdit<'t> { } if ui.memory().has_focus(id) { - if let Some(cursor_range) = state.cursor_range(&*galley) { + if let Some(cursor_range) = state.cursor_range(&galley) { // We paint the cursor on top of the text, in case // the text galley has backgrounds (as e.g. `code` snippets in markup do). paint_cursor_selection(ui, &painter, text_draw_pos, &galley, &cursor_range); @@ -703,7 +703,7 @@ fn events( password: bool, default_cursor_range: CursorRange, ) -> (bool, CursorRange) { - let mut cursor_range = state.cursor_range(&*galley).unwrap_or(default_cursor_range); + let mut cursor_range = state.cursor_range(galley).unwrap_or(default_cursor_range); // We feed state to the undoer both before and after handling input // so that the undoer creates automatic saves even when there are no events for a while. diff --git a/crates/egui_demo_app/src/frame_history.rs b/crates/egui_demo_app/src/frame_history.rs index 25ddd3fc0f1..26d8370cee4 100644 --- a/crates/egui_demo_app/src/frame_history.rs +++ b/crates/egui_demo_app/src/frame_history.rs @@ -96,7 +96,7 @@ impl FrameHistory { let cpu_usage = to_screen.inverse().transform_pos(pointer_pos).y; let text = format!("{:.1} ms", 1e3 * cpu_usage); shapes.push(Shape::text( - &*ui.fonts(), + &ui.fonts(), pos2(rect.left(), y), egui::Align2::LEFT_BOTTOM, text, diff --git a/crates/egui_extras/src/datepicker/button.rs b/crates/egui_extras/src/datepicker/button.rs index dd9632e1125..23ccbd5bfbf 100644 --- a/crates/egui_extras/src/datepicker/button.rs +++ b/crates/egui_extras/src/datepicker/button.rs @@ -63,7 +63,7 @@ impl<'a> DatePickerButton<'a> { impl<'a> Widget for DatePickerButton<'a> { fn ui(self, ui: &mut Ui) -> egui::Response { - let id = ui.make_persistent_id(&self.id_source); + let id = ui.make_persistent_id(self.id_source); let mut button_state = ui .memory() .data @@ -104,7 +104,7 @@ impl<'a> Widget for DatePickerButton<'a> { let InnerResponse { inner: saved, response: area_response, - } = Area::new(ui.make_persistent_id(&self.id_source)) + } = Area::new(ui.make_persistent_id(self.id_source)) .order(Order::Foreground) .fixed_pos(pos) .show(ui.ctx(), |ui| { diff --git a/crates/egui_extras/src/datepicker/popup.rs b/crates/egui_extras/src/datepicker/popup.rs index b5331bb2a0d..445e2d6f0b2 100644 --- a/crates/egui_extras/src/datepicker/popup.rs +++ b/crates/egui_extras/src/datepicker/popup.rs @@ -67,7 +67,7 @@ impl<'a> DatePickerPopup<'a> { ) .sizes( Size::exact((spacing + height) * (weeks.len() + 1) as f32), - if self.calendar { 1 } else { 0 }, + self.calendar as usize, ) .size(Size::exact(height)) .vertical(|mut strip| { diff --git a/crates/epaint/src/mutex.rs b/crates/epaint/src/mutex.rs index 80475991ce8..19cf59b5f8f 100644 --- a/crates/epaint/src/mutex.rs +++ b/crates/epaint/src/mutex.rs @@ -183,7 +183,7 @@ mod rw_lock_impl { type Target = T; fn deref(&self) -> &Self::Target { - &**self.guard.as_ref().unwrap() + self.guard.as_ref().unwrap() } } @@ -222,13 +222,13 @@ mod rw_lock_impl { type Target = T; fn deref(&self) -> &Self::Target { - &**self.guard.as_ref().unwrap() + self.guard.as_ref().unwrap() } } impl<'a, T> DerefMut for RwLockWriteGuard<'a, T> { fn deref_mut(&mut self) -> &mut Self::Target { - &mut **self.guard.as_mut().unwrap() + self.guard.as_mut().unwrap() } } diff --git a/examples/custom_3d_three-d/src/lib.rs b/examples/custom_3d_three-d/src/lib.rs index ff2e4fd15ee..9d081b179f4 100644 --- a/examples/custom_3d_three-d/src/lib.rs +++ b/examples/custom_3d_three-d/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(special_module_name)] + mod main; // Entry point for wasm From 75575ba7dea5f8b9caddb1802914ba0373ed3397 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 16 Nov 2022 18:33:38 +0100 Subject: [PATCH 3/4] Update changelogs --- CHANGELOG.md | 2 +- crates/eframe/CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4293d9c678..c2ba1e13a8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ NOTE: [`epaint`](crates/epaint/CHANGELOG.md), [`eframe`](crates/eframe/CHANGELOG ## Unreleased -* MSRV (Minimum Supported Rust Version) is now `1.65.0`. +* MSRV (Minimum Supported Rust Version) is now `1.65.0` ([#2314](https://github.com/emilk/egui/pull/2314)). * ⚠️ BREAKING: egui now expects integrations to do all color blending in gamma space ([#2071](https://github.com/emilk/egui/pull/2071)). * ⚠️ BREAKING: if you have overlapping interactive widgets, only the top widget (last added) will be interactive ([#2244](https://github.com/emilk/egui/pull/2244)). diff --git a/crates/eframe/CHANGELOG.md b/crates/eframe/CHANGELOG.md index 07084df25a1..6402ee2a2ed 100644 --- a/crates/eframe/CHANGELOG.md +++ b/crates/eframe/CHANGELOG.md @@ -5,7 +5,7 @@ NOTE: [`egui-winit`](../egui-winit/CHANGELOG.md), [`egui_glium`](../egui_glium/C ## Unreleased -* MSRV (Minimum Supported Rust Version) is now `1.65.0`. +* MSRV (Minimum Supported Rust Version) is now `1.65.0` ([#2314](https://github.com/emilk/egui/pull/2314)). * Added `NativeOptions::fullsize_content` option on Mac to build titlebar-less windows with floating window controls ([#2049](https://github.com/emilk/egui/pull/2049)). * Added `NativeOptions::event_loop_builder` hook for apps to change platform specific event loop options ([#1952](https://github.com/emilk/egui/pull/1952)). * Enabled deferred render state initialization to support Android ([#1952](https://github.com/emilk/egui/pull/1952)). From 4cffefaf865d15678d631bbb7dfa4897d691703f Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 16 Nov 2022 18:44:06 +0100 Subject: [PATCH 4/4] More clippy fixes --- crates/eframe/src/web/events.rs | 6 +++--- crates/egui_demo_app/src/lib.rs | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/crates/eframe/src/web/events.rs b/crates/eframe/src/web/events.rs index b3030e0d160..02cfdeadb6b 100644 --- a/crates/eframe/src/web/events.rs +++ b/crates/eframe/src/web/events.rs @@ -308,7 +308,7 @@ pub fn install_canvas_events(runner_container: &mut AppRunnerContainer) -> Resul modifiers, }); - push_touches(&mut *runner_lock, egui::TouchPhase::Start, &event); + push_touches(&mut runner_lock, egui::TouchPhase::Start, &event); runner_lock.needs_repaint.repaint_asap(); event.stop_propagation(); event.prevent_default(); @@ -330,7 +330,7 @@ pub fn install_canvas_events(runner_container: &mut AppRunnerContainer) -> Resul .events .push(egui::Event::PointerMoved(pos)); - push_touches(&mut *runner_lock, egui::TouchPhase::Move, &event); + push_touches(&mut runner_lock, egui::TouchPhase::Move, &event); runner_lock.needs_repaint.repaint_asap(); event.stop_propagation(); event.prevent_default(); @@ -357,7 +357,7 @@ pub fn install_canvas_events(runner_container: &mut AppRunnerContainer) -> Resul // Then remove hover effect: runner_lock.input.raw.events.push(egui::Event::PointerGone); - push_touches(&mut *runner_lock, egui::TouchPhase::End, &event); + push_touches(&mut runner_lock, egui::TouchPhase::End, &event); runner_lock.needs_repaint.repaint_asap(); event.stop_propagation(); event.prevent_default(); diff --git a/crates/egui_demo_app/src/lib.rs b/crates/egui_demo_app/src/lib.rs index 002def1b7f4..5693c3800a6 100644 --- a/crates/egui_demo_app/src/lib.rs +++ b/crates/egui_demo_app/src/lib.rs @@ -59,15 +59,13 @@ pub fn init_wasm_hooks() { #[wasm_bindgen] pub async fn start_separate(canvas_id: &str) -> Result { let web_options = eframe::WebOptions::default(); - let handle = eframe::start_web( + eframe::start_web( canvas_id, web_options, Box::new(|cc| Box::new(WrapApp::new(cc))), ) .await - .map(|handle| WebHandle { handle }); - - handle + .map(|handle| WebHandle { handle }) } /// This is the entry-point for all the web-assembly.