diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index c3bc239276b..98a3b496a21 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,7 +6,7 @@ Please read the "Making a PR" section of [`CONTRIBUTING.md`](https://github.com/ * If applicable, add a screenshot or gif. * If it is a non-trivial addition, consider adding a demo for it to `egui_demo_lib`, or a new example. * Do NOT open PR:s from your `master` branch, as that makes it hard for maintainers to add commits to your PR. -* Remember to run `cargo fmt` and `cargo cranky`. +* Remember to run `cargo fmt` and `cargo clippy`. * Open the PR as a draft until you have self-reviewed it and run `./scripts/check.sh`. * When you have addressed a PR comment, mark it as resolved. diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 89983a2c48b..26404d294a3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -40,11 +40,6 @@ jobs: - name: Lint vertical spacing run: ./scripts/lint.py - - name: Install cargo-cranky - uses: baptiste0928/cargo-install@v1 - with: - crate: cargo-cranky - - name: check --all-features run: cargo check --locked --all-features --all-targets @@ -78,11 +73,11 @@ jobs: - name: Test run: cargo test --all-features - - name: Cranky - run: cargo cranky --all-targets --all-features -- -D warnings + - name: clippy + run: cargo clippy --all-targets --all-features -- -D warnings - - name: Cranky release - run: cargo cranky --all-targets --all-features --release -- -D warnings + - name: clippy release + run: cargo clippy --all-targets --all-features --release -- -D warnings # --------------------------------------------------------------------------- @@ -101,11 +96,6 @@ jobs: - name: Set up cargo cache uses: Swatinem/rust-cache@v2 - - name: Install cargo-cranky - uses: baptiste0928/cargo-install@v1 - with: - crate: cargo-cranky - - name: Check wasm32 egui_demo_app run: cargo check -p egui_demo_app --lib --target wasm32-unknown-unknown @@ -122,7 +112,7 @@ jobs: - run: ./scripts/wasm_bindgen_check.sh --skip-setup - - name: Cranky wasm32 + - name: clippy wasm32 run: ./scripts/clippy_wasm.sh # --------------------------------------------------------------------------- diff --git a/Cargo.toml b/Cargo.toml index 47ef422cb5a..c94baab2843 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -84,3 +84,169 @@ wgpu = { version = "0.19.1", default-features = false, features = [ "fragile-send-sync-non-atomic-wasm", ] } winit = { version = "0.29.4", default-features = false } + + +[workspace.lints.rust] +unsafe_code = "deny" + +elided_lifetimes_in_paths = "warn" +future_incompatible = "warn" +nonstandard_style = "warn" +rust_2018_idioms = "warn" +rust_2021_prelude_collisions = "warn" +semicolon_in_expressions_from_macros = "warn" +trivial_numeric_casts = "warn" +unsafe_op_in_unsafe_fn = "warn" # `unsafe_op_in_unsafe_fn` may become the default in future Rust versions: https://github.com/rust-lang/rust/issues/71668 +unused_extern_crates = "warn" +unused_import_braces = "warn" +unused_lifetimes = "warn" + +trivial_casts = "allow" +unused_qualifications = "allow" + +[workspace.lints.rustdoc] +all = "warn" +missing_crate_level_docs = "warn" + +# See also clippy.toml +[workspace.lints.clippy] +as_ptr_cast_mut = "warn" +await_holding_lock = "warn" +bool_to_int_with_if = "warn" +char_lit_as_u8 = "warn" +checked_conversions = "warn" +clear_with_drain = "warn" +cloned_instead_of_copied = "warn" +dbg_macro = "warn" +debug_assert_with_mut_call = "warn" +derive_partial_eq_without_eq = "warn" +disallowed_macros = "warn" # See clippy.toml +disallowed_methods = "warn" # See clippy.toml +disallowed_names = "warn" # See clippy.toml +disallowed_script_idents = "warn" # See clippy.toml +disallowed_types = "warn" # See clippy.toml +doc_link_with_quotes = "warn" +doc_markdown = "warn" +empty_enum = "warn" +enum_glob_use = "warn" +equatable_if_let = "warn" +exit = "warn" +expl_impl_clone_on_copy = "warn" +explicit_deref_methods = "warn" +explicit_into_iter_loop = "warn" +explicit_iter_loop = "warn" +fallible_impl_from = "warn" +filter_map_next = "warn" +flat_map_option = "warn" +float_cmp_const = "warn" +fn_params_excessive_bools = "warn" +fn_to_numeric_cast_any = "warn" +from_iter_instead_of_collect = "warn" +get_unwrap = "warn" +if_let_mutex = "warn" +implicit_clone = "warn" +implied_bounds_in_impls = "warn" +imprecise_flops = "warn" +index_refutable_slice = "warn" +inefficient_to_string = "warn" +infinite_loop = "warn" +into_iter_without_iter = "warn" +invalid_upcast_comparisons = "warn" +iter_not_returning_iterator = "warn" +iter_on_empty_collections = "warn" +iter_on_single_items = "warn" +iter_without_into_iter = "warn" +large_digit_groups = "warn" +large_include_file = "warn" +large_stack_arrays = "warn" +large_stack_frames = "warn" +large_types_passed_by_value = "warn" +let_unit_value = "warn" +linkedlist = "warn" +lossy_float_literal = "warn" +macro_use_imports = "warn" +manual_assert = "warn" +manual_clamp = "warn" +manual_instant_elapsed = "warn" +manual_let_else = "warn" +manual_ok_or = "warn" +manual_string_new = "warn" +map_err_ignore = "warn" +map_flatten = "warn" +map_unwrap_or = "warn" +match_on_vec_items = "warn" +match_same_arms = "warn" +match_wild_err_arm = "warn" +match_wildcard_for_single_variants = "warn" +mem_forget = "warn" +mismatched_target_os = "warn" +mismatching_type_param_order = "warn" +missing_enforced_import_renames = "warn" +missing_errors_doc = "warn" +missing_safety_doc = "warn" +mut_mut = "warn" +mutex_integer = "warn" +needless_borrow = "warn" +needless_continue = "warn" +needless_for_each = "warn" +needless_pass_by_ref_mut = "warn" +needless_pass_by_value = "warn" +negative_feature_names = "warn" +nonstandard_macro_braces = "warn" +option_option = "warn" +path_buf_push_overwrite = "warn" +ptr_as_ptr = "warn" +ptr_cast_constness = "warn" +pub_without_shorthand = "warn" +rc_mutex = "warn" +readonly_write_lock = "warn" +redundant_type_annotations = "warn" +ref_option_ref = "warn" +ref_patterns = "warn" +rest_pat_in_fully_bound_structs = "warn" +same_functions_in_if_condition = "warn" +semicolon_if_nothing_returned = "warn" +single_match_else = "warn" +str_to_string = "warn" +string_add = "warn" +string_add_assign = "warn" +string_lit_as_bytes = "warn" +string_lit_chars_any = "warn" +string_to_string = "warn" +suspicious_command_arg_space = "warn" +suspicious_xor_used_as_pow = "warn" +todo = "warn" +trailing_empty_array = "warn" +trait_duplication_in_bounds = "warn" +tuple_array_conversions = "warn" +unchecked_duration_subtraction = "warn" +undocumented_unsafe_blocks = "warn" +unimplemented = "warn" +uninhabited_references = "warn" +uninlined_format_args = "warn" +unnecessary_box_returns = "warn" +unnecessary_safety_doc = "warn" +unnecessary_struct_initialization = "warn" +unnecessary_wraps = "warn" +unnested_or_patterns = "warn" +unused_peekable = "warn" +unused_rounding = "warn" +unused_self = "warn" +useless_transmute = "warn" +verbose_file_reads = "warn" +wildcard_dependencies = "warn" +zero_sized_map_values = "warn" + +# TODO(emilk): enable more of these linits: +iter_over_hash_type = "allow" +let_underscore_untyped = "allow" +missing_assert_message = "allow" +print_stderr = "allow" # TODO(emilk): use `log` crate insteaditer_over_hash_type = "allow" +should_panic_without_expect = "allow" +too_many_lines = "allow" +unwrap_used = "allow" # TODO(emilk): We really wanna warn on this one + +manual_range_contains = "allow" # this one is just worse imho +self_named_module_files = "allow" # Disabled waiting on https://github.com/rust-lang/rust-clippy/issues/9602 +significant_drop_tightening = "allow" # Too many false positives +wildcard_imports = "allow" # we do this a lot in egui diff --git a/Cranky.toml b/Cranky.toml deleted file mode 100644 index db236bff421..00000000000 --- a/Cranky.toml +++ /dev/null @@ -1,176 +0,0 @@ -# https://github.com/ericseppanen/cargo-cranky -# cargo install cargo-cranky && cargo cranky -# See also clippy.toml - -deny = ["unsafe_code"] - -warn = [ - "clippy::all", - "clippy::as_ptr_cast_mut", - "clippy::await_holding_lock", - "clippy::bool_to_int_with_if", - "clippy::branches_sharing_code", - "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::default_union_representation", - "clippy::derive_partial_eq_without_eq", - "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", - "clippy::empty_line_after_outer_attr", - "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::get_unwrap", - "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_include_file", - "clippy::large_stack_arrays", - "clippy::large_stack_frames", - "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_clamp", - "clippy::manual_instant_elapsed", - "clippy::manual_let_else", - "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::print_stdout", - "clippy::ptr_as_ptr", - "clippy::ptr_cast_constness", - "clippy::pub_without_shorthand", - "clippy::rc_mutex", - "clippy::redundant_type_annotations", - "clippy::ref_option_ref", - "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::transmute_ptr_to_ptr", - "clippy::tuple_array_conversions", - "clippy::unchecked_duration_subtraction", - "clippy::undocumented_unsafe_blocks", - "clippy::unimplemented", - "clippy::uninlined_format_args", - "clippy::unnecessary_box_returns", - "clippy::unnecessary_safety_comment", - "clippy::unnecessary_safety_doc", - "clippy::unnecessary_self_imports", - "clippy::unnecessary_struct_initialization", - "clippy::unnecessary_wraps", - "clippy::unnested_or_patterns", - "clippy::unused_peekable", - "clippy::unused_rounding", - "clippy::unused_self", - "clippy::use_self", - "clippy::useless_transmute", - "clippy::verbose_file_reads", - "clippy::wildcard_dependencies", - "clippy::wildcard_imports", - "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", - "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_extern_crates", - "unused_import_braces", - "unused_lifetimes", - - - # Enable when we update MSRV: - # "clippy::implied_bounds_in_impls", - # "clippy::needless_pass_by_ref_mut", - # "clippy::readonly_write_lock", - # "clippy::should_panic_without_expect", - # "clippy::string_lit_chars_any", -] - -allow = [ - "clippy::manual_range_contains", # this one is just worse imho - "clippy::significant_drop_tightening", # A lot of false positives - - # TODO(emilk): enable more of these lints: - "clippy::cloned_instead_of_copied", - "clippy::let_underscore_untyped", - "clippy::missing_assert_message", - "clippy::missing_errors_doc", - "clippy::print_stderr", # TODO(emilk): use `log` crate instead - "clippy::self_named_module_files", # False positives - "clippy::too_many_lines", - "clippy::undocumented_unsafe_blocks", - "clippy::unwrap_used", - "clippy::useless_let_if_seq", # False positives - "clippy::wildcard_imports", # We do this a lot - "trivial_casts", - "unused_qualifications", -] diff --git a/bacon.toml b/bacon.toml deleted file mode 100644 index 63d72eeb055..00000000000 --- a/bacon.toml +++ /dev/null @@ -1,74 +0,0 @@ -# This is a configuration file for the bacon tool -# More info at https://github.com/Canop/bacon - -default_job = "cranky" - -[jobs] - -[jobs.cranky] -command = [ - "cargo", - "cranky", - "--all-targets", - "--all-features", - "--color=always", -] -need_stdout = false -watch = ["tests", "benches", "examples"] - -[jobs.wasm] -command = [ - "cargo", - "cranky", - "-p=egui_demo_app", - "--lib", - "--target=wasm32-unknown-unknown", - "--target-dir=target_wasm", - "--all-features", - "--color=always", -] -need_stdout = false -watch = ["tests", "benches", "examples"] - -[jobs.test] -command = ["cargo", "test", "--color=always"] -need_stdout = true -watch = ["tests"] - -[jobs.doc] -command = ["cargo", "doc", "--color=always", "--all-features", "--no-deps"] -need_stdout = false - -# if the doc compiles, then it opens in your browser and bacon switches -# to the previous job -[jobs.doc-open] -command = [ - "cargo", - "doc", - "--color=always", - "--all-features", - "--no-deps", - "--open", -] -need_stdout = false -on_success = "back" # so that we don't open the browser at each change - -# You can run your application and have the result displayed in bacon, -# *if* it makes sense for this crate. You can run an example the same -# way. Don't forget the `--color always` part or the errors won't be -# properly parsed. -[jobs.run] -command = ["cargo", "run", "--color=always"] -need_stdout = true - -# You may define here keybindings that would be specific to -# a project, for example a shortcut to launch a specific job. -# Shortcuts to internal functions (scrolling, toggling, etc.) -# should go in your personal prefs.toml file instead. -[keybindings] -i = "job:initial" -c = "job:cranky" -a = "job:wasm" -d = "job:doc-open" -t = "job:test" -r = "job:run" diff --git a/crates/ecolor/Cargo.toml b/crates/ecolor/Cargo.toml index 611b9a4dec9..ad5d6f96369 100644 --- a/crates/ecolor/Cargo.toml +++ b/crates/ecolor/Cargo.toml @@ -16,6 +16,9 @@ categories = ["mathematics", "encoding"] keywords = ["gui", "color", "conversion", "gamedev", "images"] include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"] +[lints] +workspace = true + [package.metadata.docs.rs] all-features = true diff --git a/crates/eframe/Cargo.toml b/crates/eframe/Cargo.toml index 5b2651c9ad4..c5cfae87733 100644 --- a/crates/eframe/Cargo.toml +++ b/crates/eframe/Cargo.toml @@ -24,6 +24,9 @@ all-features = true rustc-args = ["--cfg=web_sys_unstable_apis"] targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"] +[lints] +workspace = true + [lib] diff --git a/crates/eframe/src/native/app_icon.rs b/crates/eframe/src/native/app_icon.rs index 39c32dfdb3e..90100298680 100644 --- a/crates/eframe/src/native/app_icon.rs +++ b/crates/eframe/src/native/app_icon.rs @@ -224,6 +224,7 @@ fn set_title_and_icon_mac(title: &str, icon_data: Option<&IconData>) -> AppIconS static NSApp: Option<&'static NSApplication>; } + // SAFETY: we don't do anything dangerous here unsafe { let Some(app) = NSApp else { log::debug!("NSApp is null"); diff --git a/crates/eframe/src/native/glow_integration.rs b/crates/eframe/src/native/glow_integration.rs index 880b906c2b8..f08ed14d623 100644 --- a/crates/eframe/src/native/glow_integration.rs +++ b/crates/eframe/src/native/glow_integration.rs @@ -5,7 +5,11 @@ //! There is a bunch of improvements we could do, //! like removing a bunch of `unwraps`. -#![allow(clippy::arc_with_non_send_sync)] // glow::Context was accidentally non-Sync in glow 0.13, but that will be fixed in future releases of glow: https://github.com/grovesNL/glow/commit/c4a5f7151b9b4bbb380faa06ec27415235d1bf7e +// `clippy::arc_with_non_send_sync`: `glow::Context` was accidentally non-Sync in glow 0.13, +// but that will be fixed in future releases of glow. +// https://github.com/grovesNL/glow/commit/c4a5f7151b9b4bbb380faa06ec27415235d1bf7e +#![allow(clippy::arc_with_non_send_sync)] +#![allow(clippy::undocumented_unsafe_blocks)] use std::{cell::RefCell, num::NonZeroU32, rc::Rc, sync::Arc, time::Instant}; diff --git a/crates/eframe/src/web/text_agent.rs b/crates/eframe/src/web/text_agent.rs index c61b7093596..5cfec81bf30 100644 --- a/crates/eframe/src/web/text_agent.rs +++ b/crates/eframe/src/web/text_agent.rs @@ -119,7 +119,7 @@ pub fn install_text_agent(runner_ref: &WebRunner) -> Result<(), JsValue> { } /// Focus or blur text agent to toggle mobile keyboard. -pub fn update_text_agent(runner: &mut AppRunner) -> Option<()> { +pub fn update_text_agent(runner: &AppRunner) -> Option<()> { use web_sys::HtmlInputElement; let window = web_sys::window()?; let document = window.document()?; diff --git a/crates/egui-wgpu/Cargo.toml b/crates/egui-wgpu/Cargo.toml index 09e48e07643..817233b88ba 100644 --- a/crates/egui-wgpu/Cargo.toml +++ b/crates/egui-wgpu/Cargo.toml @@ -23,6 +23,9 @@ include = [ "Cargo.toml", ] +[lints] +workspace = true + [package.metadata.docs.rs] all-features = true diff --git a/crates/egui-wgpu/src/winit.rs b/crates/egui-wgpu/src/winit.rs index 07c917155aa..84dd0b41235 100644 --- a/crates/egui-wgpu/src/winit.rs +++ b/crates/egui-wgpu/src/winit.rs @@ -1,3 +1,6 @@ +#![allow(clippy::missing_errors_doc)] +#![allow(clippy::undocumented_unsafe_blocks)] + use std::{num::NonZeroU32, sync::Arc}; use egui::{ViewportId, ViewportIdMap, ViewportIdSet}; diff --git a/crates/egui-winit/Cargo.toml b/crates/egui-winit/Cargo.toml index a09829699fc..fc2b8a53620 100644 --- a/crates/egui-winit/Cargo.toml +++ b/crates/egui-winit/Cargo.toml @@ -13,6 +13,9 @@ categories = ["gui", "game-development"] keywords = ["winit", "egui", "gui", "gamedev"] include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"] +[lints] +workspace = true + [package.metadata.docs.rs] all-features = true diff --git a/crates/egui-winit/src/clipboard.rs b/crates/egui-winit/src/clipboard.rs index c86a9e19d5b..44e3840b64f 100644 --- a/crates/egui-winit/src/clipboard.rs +++ b/crates/egui-winit/src/clipboard.rs @@ -137,6 +137,8 @@ fn init_arboard() -> Option { fn init_smithay_clipboard( raw_display_handle: Option, ) -> Option { + #![allow(clippy::undocumented_unsafe_blocks)] + crate::profile_function!(); if let Some(RawDisplayHandle::Wayland(display)) = raw_display_handle { diff --git a/crates/egui-winit/src/lib.rs b/crates/egui-winit/src/lib.rs index 313cc58906b..abadd9ee5c2 100644 --- a/crates/egui-winit/src/lib.rs +++ b/crates/egui-winit/src/lib.rs @@ -56,7 +56,7 @@ pub struct EventResponse { /// (e.g. a mouse click on an egui window, or entering text into a text field). /// /// For instance, if you use egui for a game, you should only - /// pass on the events to your game when [`Self::consumed`] is `false. + /// pass on the events to your game when [`Self::consumed`] is `false`. /// /// Note that egui uses `tab` to move focus between elements, so this will always be `true` for tabs. pub consumed: bool, @@ -1521,6 +1521,9 @@ fn process_viewport_command( /// Build and intitlaize a window. /// /// Wrapper around `create_winit_window_builder` and `apply_viewport_builder_to_window`. +/// +/// # Errors +/// Possible causes of error include denied permission, incompatible system, and lack of memory. pub fn create_window( egui_ctx: &egui::Context, event_loop: &EventLoopWindowTarget, diff --git a/crates/egui/Cargo.toml b/crates/egui/Cargo.toml index 87b25a7ea4b..a1929f060ad 100644 --- a/crates/egui/Cargo.toml +++ b/crates/egui/Cargo.toml @@ -13,6 +13,9 @@ categories = ["gui", "game-development"] keywords = ["gui", "imgui", "immediate", "portable", "gamedev"] include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"] +[lints] +workspace = true + [package.metadata.docs.rs] all-features = true diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index aa8a0b13e32..192b0cc49d4 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -1838,7 +1838,7 @@ impl Context { let paint_widget_id = |id: Id, text: &str, color: Color32| { if let Some(widget) = - self.write(|ctx| ctx.viewport().widgets_this_frame.get(id).cloned()) + self.write(|ctx| ctx.viewport().widgets_this_frame.get(id).copied()) { paint_widget(&widget, text, color); } @@ -2398,7 +2398,7 @@ impl Context { /// See also [`Response::contains_pointer`]. pub fn rect_contains_pointer(&self, layer_id: LayerId, rect: Rect) -> bool { let rect = - if let Some(transform) = self.memory(|m| m.layer_transforms.get(&layer_id).cloned()) { + if let Some(transform) = self.memory(|m| m.layer_transforms.get(&layer_id).copied()) { transform * rect } else { rect diff --git a/crates/egui/src/data/key.rs b/crates/egui/src/data/key.rs index 92e6b69dba2..66fe6b9336f 100644 --- a/crates/egui/src/data/key.rs +++ b/crates/egui/src/data/key.rs @@ -35,25 +35,25 @@ pub enum Key { /// `,` Comma, - /// '\\' + /// `\` Backslash, - /// '/' + /// `/` Slash, - /// '|', a vertical bar + /// `|`, a vertical bar Pipe, /// `?` Questionmark, - // '[' + // `[` OpenBracket, - // ']' + // `]` CloseBracket, - /// '`', also known as "backquote" or "grave" + /// \`, also known as "backquote" or "grave" Backtick, /// `-` diff --git a/crates/egui/src/load/bytes_loader.rs b/crates/egui/src/load/bytes_loader.rs index 3ab46794912..d03b2ad418a 100644 --- a/crates/egui/src/load/bytes_loader.rs +++ b/crates/egui/src/load/bytes_loader.rs @@ -53,7 +53,7 @@ impl BytesLoader for DefaultBytesLoader { #[cfg(feature = "log")] log::trace!("forget {uri:?}"); - let _ = self.cache.lock().remove(uri); + self.cache.lock().remove(uri); } fn forget_all(&self) { diff --git a/crates/egui/src/response.rs b/crates/egui/src/response.rs index 1bee1b29860..44eb4f74bd6 100644 --- a/crates/egui/src/response.rs +++ b/crates/egui/src/response.rs @@ -465,7 +465,7 @@ impl Response { let mut pos = self.ctx.input(|i| i.pointer.hover_pos())?; if let Some(transform) = self .ctx - .memory(|m| m.layer_transforms.get(&self.layer_id).cloned()) + .memory(|m| m.layer_transforms.get(&self.layer_id).copied()) { pos = transform * pos; } diff --git a/crates/egui/src/text_selection/visuals.rs b/crates/egui/src/text_selection/visuals.rs index 4fc8af0abd4..d31f1756edd 100644 --- a/crates/egui/src/text_selection/visuals.rs +++ b/crates/egui/src/text_selection/visuals.rs @@ -78,7 +78,7 @@ pub fn paint_cursor_end(painter: &Painter, visuals: &Visuals, cursor_rect: Rect) /// Paint one end of the selection, e.g. the primary cursor, with blinking (if enabled). pub fn paint_text_cursor( - ui: &mut Ui, + ui: &Ui, painter: &Painter, primary_cursor_rect: Rect, time_since_last_edit: f64, diff --git a/crates/egui/src/widgets/text_edit/builder.rs b/crates/egui/src/widgets/text_edit/builder.rs index c0b8532d6d9..440916f31b2 100644 --- a/crates/egui/src/widgets/text_edit/builder.rs +++ b/crates/egui/src/widgets/text_edit/builder.rs @@ -702,7 +702,7 @@ impl<'t> TextEdit<'t> { // Set IME output (in screen coords) when text is editable and visible let transform = ui - .memory(|m| m.layer_transforms.get(&ui.layer_id()).cloned()) + .memory(|m| m.layer_transforms.get(&ui.layer_id()).copied()) .unwrap_or_default(); ui.ctx().output_mut(|o| { @@ -948,7 +948,7 @@ fn events( key, pressed: true, .. - } => check_for_mutating_key_press(os, &mut cursor_range, text, galley, modifiers, *key), + } => check_for_mutating_key_press(os, &cursor_range, text, galley, modifiers, *key), Event::Ime(ime_event) => match ime_event { ImeEvent::Enabled => { @@ -1028,7 +1028,7 @@ fn events( /// Returns `Some(new_cursor)` if we did mutate `text`. fn check_for_mutating_key_press( os: OperatingSystem, - cursor_range: &mut CursorRange, + cursor_range: &CursorRange, text: &mut dyn TextBuffer, galley: &Galley, modifiers: &Modifiers, diff --git a/crates/egui_demo_app/Cargo.toml b/crates/egui_demo_app/Cargo.toml index b928702e08b..4ae9572bd0a 100644 --- a/crates/egui_demo_app/Cargo.toml +++ b/crates/egui_demo_app/Cargo.toml @@ -8,6 +8,9 @@ rust-version.workspace = true publish = false default-run = "egui_demo_app" +[lints] +workspace = true + [package.metadata.docs.rs] all-features = true diff --git a/crates/egui_demo_app/src/apps/custom3d_glow.rs b/crates/egui_demo_app/src/apps/custom3d_glow.rs index 7f488e7671e..ad6bfc3bc60 100644 --- a/crates/egui_demo_app/src/apps/custom3d_glow.rs +++ b/crates/egui_demo_app/src/apps/custom3d_glow.rs @@ -1,3 +1,5 @@ +#![allow(clippy::undocumented_unsafe_blocks)] + use std::sync::Arc; use eframe::egui_glow; diff --git a/crates/egui_demo_app/src/apps/http_app.rs b/crates/egui_demo_app/src/apps/http_app.rs index d0da5c0a395..d6b57284267 100644 --- a/crates/egui_demo_app/src/apps/http_app.rs +++ b/crates/egui_demo_app/src/apps/http_app.rs @@ -116,7 +116,7 @@ impl eframe::App for HttpApp { } } -fn ui_url(ui: &mut egui::Ui, frame: &mut eframe::Frame, url: &mut String) -> bool { +fn ui_url(ui: &mut egui::Ui, frame: &eframe::Frame, url: &mut String) -> bool { let mut trigger_fetch = false; ui.horizontal(|ui| { diff --git a/crates/egui_demo_app/src/main.rs b/crates/egui_demo_app/src/main.rs index 45b0ee067a4..9d660ed046c 100644 --- a/crates/egui_demo_app/src/main.rs +++ b/crates/egui_demo_app/src/main.rs @@ -1,6 +1,7 @@ //! Demo app for egui #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example #![allow(clippy::never_loop)] // False positive // When compiling natively: diff --git a/crates/egui_demo_lib/Cargo.toml b/crates/egui_demo_lib/Cargo.toml index 8c5a703b5d6..d1daa5b8cfb 100644 --- a/crates/egui_demo_lib/Cargo.toml +++ b/crates/egui_demo_lib/Cargo.toml @@ -19,6 +19,9 @@ include = [ "data/icon.png", ] +[lints] +workspace = true + [package.metadata.docs.rs] all-features = true diff --git a/crates/egui_demo_lib/src/easy_mark/easy_mark_editor.rs b/crates/egui_demo_lib/src/easy_mark/easy_mark_editor.rs index 0b0bb9608a3..be2650cb03e 100644 --- a/crates/egui_demo_lib/src/easy_mark/easy_mark_editor.rs +++ b/crates/egui_demo_lib/src/easy_mark/easy_mark_editor.rs @@ -45,7 +45,7 @@ impl EasyMarkEditor { pub fn ui(&mut self, ui: &mut egui::Ui) { egui::Grid::new("controls").show(ui, |ui| { - let _ = ui.button("Hotkeys").on_hover_ui(nested_hotkeys_ui); + let _response = ui.button("Hotkeys").on_hover_ui(nested_hotkeys_ui); ui.checkbox(&mut self.show_rendered, "Show rendered"); ui.checkbox(&mut self.highlight_editor, "Highlight editor"); egui::reset_button(ui, self, "Reset"); diff --git a/crates/egui_extras/Cargo.toml b/crates/egui_extras/Cargo.toml index a0829180924..372f754cc52 100644 --- a/crates/egui_extras/Cargo.toml +++ b/crates/egui_extras/Cargo.toml @@ -17,6 +17,9 @@ categories = ["gui", "game-development"] keywords = ["gui", "imgui", "immediate", "portable", "gamedev"] include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"] +[lints] +workspace = true + [package.metadata.docs.rs] all-features = true diff --git a/crates/egui_glow/Cargo.toml b/crates/egui_glow/Cargo.toml index 1ee1f6cd90b..6bb081980d3 100644 --- a/crates/egui_glow/Cargo.toml +++ b/crates/egui_glow/Cargo.toml @@ -19,6 +19,9 @@ include = [ "src/shader/*.glsl", ] +[lints] +workspace = true + [package.metadata.docs.rs] all-features = true diff --git a/crates/egui_glow/examples/pure_glow.rs b/crates/egui_glow/examples/pure_glow.rs index 3da382af6ec..70f07421475 100644 --- a/crates/egui_glow/examples/pure_glow.rs +++ b/crates/egui_glow/examples/pure_glow.rs @@ -1,8 +1,11 @@ //! Example how to use pure `egui_glow`. #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example +#![allow(clippy::undocumented_unsafe_blocks)] +#![allow(clippy::arc_with_non_send_sync)] +// `clippy::arc_with_non_send_sync`: `glow::Context` was accidentally non-Sync in glow 0.13, but that will be fixed in future releases of glow: https://github.com/grovesNL/glow/commit/c4a5f7151b9b4bbb380faa06ec27415235d1bf7e #![allow(unsafe_code)] -#![allow(clippy::arc_with_non_send_sync)] // glow::Context was accidentally non-Sync in glow 0.13, but that will be fixed in future releases of glow: https://github.com/grovesNL/glow/commit/c4a5f7151b9b4bbb380faa06ec27415235d1bf7e use std::num::NonZeroU32; diff --git a/crates/egui_glow/src/lib.rs b/crates/egui_glow/src/lib.rs index b12d2ff5f61..8621dbd74e7 100644 --- a/crates/egui_glow/src/lib.rs +++ b/crates/egui_glow/src/lib.rs @@ -10,6 +10,7 @@ #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] +#![allow(clippy::undocumented_unsafe_blocks)] pub mod painter; pub use glow; diff --git a/crates/egui_glow/src/shader_version.rs b/crates/egui_glow/src/shader_version.rs index c59792a0aba..77c1e63cea9 100644 --- a/crates/egui_glow/src/shader_version.rs +++ b/crates/egui_glow/src/shader_version.rs @@ -1,4 +1,5 @@ #![allow(unsafe_code)] +#![allow(clippy::undocumented_unsafe_blocks)] use std::convert::TryInto; diff --git a/crates/egui_plot/Cargo.toml b/crates/egui_plot/Cargo.toml index 61faf7432c0..91c4b3a50fc 100644 --- a/crates/egui_plot/Cargo.toml +++ b/crates/egui_plot/Cargo.toml @@ -17,6 +17,9 @@ categories = ["visualization", "gui"] keywords = ["egui", "plot", "plotting"] include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"] +[lints] +workspace = true + [package.metadata.docs.rs] all-features = true diff --git a/crates/emath/Cargo.toml b/crates/emath/Cargo.toml index a48a9cbdbaf..ae0153cc9f2 100644 --- a/crates/emath/Cargo.toml +++ b/crates/emath/Cargo.toml @@ -13,6 +13,9 @@ categories = ["mathematics", "gui"] keywords = ["math", "gui"] include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"] +[lints] +workspace = true + [package.metadata.docs.rs] all-features = true diff --git a/crates/epaint/Cargo.toml b/crates/epaint/Cargo.toml index a24a299b8ed..861afb1a14b 100644 --- a/crates/epaint/Cargo.toml +++ b/crates/epaint/Cargo.toml @@ -22,6 +22,9 @@ include = [ "fonts/UFL.txt", ] +[lints] +workspace = true + [package.metadata.docs.rs] all-features = true diff --git a/examples/confirm_exit/Cargo.toml b/examples/confirm_exit/Cargo.toml index 8e9d3af2872..b1cab21a1bb 100644 --- a/examples/confirm_exit/Cargo.toml +++ b/examples/confirm_exit/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ diff --git a/examples/confirm_exit/src/main.rs b/examples/confirm_exit/src/main.rs index 3a09da59d91..14816e1bdea 100644 --- a/examples/confirm_exit/src/main.rs +++ b/examples/confirm_exit/src/main.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; diff --git a/examples/custom_3d_glow/Cargo.toml b/examples/custom_3d_glow/Cargo.toml index ef3d1cbc828..3b8c9a45383 100644 --- a/examples/custom_3d_glow/Cargo.toml +++ b/examples/custom_3d_glow/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ diff --git a/examples/custom_3d_glow/src/main.rs b/examples/custom_3d_glow/src/main.rs index a1f6fa26946..241124b7c17 100644 --- a/examples/custom_3d_glow/src/main.rs +++ b/examples/custom_3d_glow/src/main.rs @@ -1,5 +1,7 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example #![allow(unsafe_code)] +#![allow(clippy::undocumented_unsafe_blocks)] use eframe::{egui, egui_glow, glow}; diff --git a/examples/custom_font/Cargo.toml b/examples/custom_font/Cargo.toml index 89840c4526d..d6021c12425 100644 --- a/examples/custom_font/Cargo.toml +++ b/examples/custom_font/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ diff --git a/examples/custom_font/src/main.rs b/examples/custom_font/src/main.rs index 8a852319dd1..f42c5763150 100644 --- a/examples/custom_font/src/main.rs +++ b/examples/custom_font/src/main.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; diff --git a/examples/custom_font_style/Cargo.toml b/examples/custom_font_style/Cargo.toml index 60e3e37b9c2..65b5045238c 100644 --- a/examples/custom_font_style/Cargo.toml +++ b/examples/custom_font_style/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ diff --git a/examples/custom_font_style/src/main.rs b/examples/custom_font_style/src/main.rs index 89117b4f01a..c1a61e3e69c 100644 --- a/examples/custom_font_style/src/main.rs +++ b/examples/custom_font_style/src/main.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; use egui::{FontFamily, FontId, RichText, TextStyle}; diff --git a/examples/custom_keypad/Cargo.toml b/examples/custom_keypad/Cargo.toml index f008884c5c7..7d000fd0d46 100644 --- a/examples/custom_keypad/Cargo.toml +++ b/examples/custom_keypad/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ diff --git a/examples/custom_keypad/src/main.rs b/examples/custom_keypad/src/main.rs index 5cb26240cbd..654de25fa44 100644 --- a/examples/custom_keypad/src/main.rs +++ b/examples/custom_keypad/src/main.rs @@ -1,4 +1,5 @@ // #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; mod keypad; diff --git a/examples/custom_plot_manipulation/Cargo.toml b/examples/custom_plot_manipulation/Cargo.toml index 3db38a45b92..fc7b66c5ccc 100644 --- a/examples/custom_plot_manipulation/Cargo.toml +++ b/examples/custom_plot_manipulation/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ diff --git a/examples/custom_plot_manipulation/src/main.rs b/examples/custom_plot_manipulation/src/main.rs index 4dffaf18ed1..e423d890fcb 100644 --- a/examples/custom_plot_manipulation/src/main.rs +++ b/examples/custom_plot_manipulation/src/main.rs @@ -1,5 +1,6 @@ //! This example shows how to implement custom gestures to pan and zoom in the plot #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui::{self, DragValue, Event, Vec2}; use egui_plot::{Legend, Line, PlotPoints}; diff --git a/examples/custom_window_frame/Cargo.toml b/examples/custom_window_frame/Cargo.toml index c334c6a662b..6b800d0a0af 100644 --- a/examples/custom_window_frame/Cargo.toml +++ b/examples/custom_window_frame/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ diff --git a/examples/custom_window_frame/src/main.rs b/examples/custom_window_frame/src/main.rs index 87daf82e06a..bb098652cbf 100644 --- a/examples/custom_window_frame/src/main.rs +++ b/examples/custom_window_frame/src/main.rs @@ -1,6 +1,7 @@ //! Show a custom window frame instead of the default OS window chrome decorations. #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui::{self, ViewportCommand}; diff --git a/examples/file_dialog/Cargo.toml b/examples/file_dialog/Cargo.toml index ef30dfce8e1..9684a423256 100644 --- a/examples/file_dialog/Cargo.toml +++ b/examples/file_dialog/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ diff --git a/examples/file_dialog/src/main.rs b/examples/file_dialog/src/main.rs index 4077c6de4a2..d0623a73a28 100644 --- a/examples/file_dialog/src/main.rs +++ b/examples/file_dialog/src/main.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; diff --git a/examples/hello_world/Cargo.toml b/examples/hello_world/Cargo.toml index acf7e2b8ab8..bdd728a61e1 100644 --- a/examples/hello_world/Cargo.toml +++ b/examples/hello_world/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ diff --git a/examples/hello_world/src/main.rs b/examples/hello_world/src/main.rs index b3fda5a5810..1c74f4c4992 100644 --- a/examples/hello_world/src/main.rs +++ b/examples/hello_world/src/main.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; diff --git a/examples/hello_world_par/Cargo.toml b/examples/hello_world_par/Cargo.toml index 3d0e92eaec4..e64cdd36108 100644 --- a/examples/hello_world_par/Cargo.toml +++ b/examples/hello_world_par/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, default-features = false, features = [ diff --git a/examples/hello_world_par/src/main.rs b/examples/hello_world_par/src/main.rs index 617e840dc4c..2896f24843f 100644 --- a/examples/hello_world_par/src/main.rs +++ b/examples/hello_world_par/src/main.rs @@ -1,6 +1,7 @@ //! This example shows that you can use egui in parallel from multiple threads. #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use std::sync::mpsc; use std::thread::JoinHandle; diff --git a/examples/hello_world_simple/Cargo.toml b/examples/hello_world_simple/Cargo.toml index bec4670b790..c88382b9f6d 100644 --- a/examples/hello_world_simple/Cargo.toml +++ b/examples/hello_world_simple/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ diff --git a/examples/hello_world_simple/src/main.rs b/examples/hello_world_simple/src/main.rs index 5f0ed31a49f..4e48feeff90 100644 --- a/examples/hello_world_simple/src/main.rs +++ b/examples/hello_world_simple/src/main.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; diff --git a/examples/images/Cargo.toml b/examples/images/Cargo.toml index cd9157f5715..092535c9125 100644 --- a/examples/images/Cargo.toml +++ b/examples/images/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ diff --git a/examples/images/src/main.rs b/examples/images/src/main.rs index efb088b6727..8a124e051a5 100644 --- a/examples/images/src/main.rs +++ b/examples/images/src/main.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; diff --git a/examples/keyboard_events/Cargo.toml b/examples/keyboard_events/Cargo.toml index 08f7ba3a81e..f7b12047062 100644 --- a/examples/keyboard_events/Cargo.toml +++ b/examples/keyboard_events/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ diff --git a/examples/keyboard_events/src/main.rs b/examples/keyboard_events/src/main.rs index 581ae11eb74..bf0b3389981 100644 --- a/examples/keyboard_events/src/main.rs +++ b/examples/keyboard_events/src/main.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; use egui::*; diff --git a/examples/multiple_viewports/Cargo.toml b/examples/multiple_viewports/Cargo.toml index b5bd8e80411..7aad28550fc 100644 --- a/examples/multiple_viewports/Cargo.toml +++ b/examples/multiple_viewports/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [features] wgpu = ["eframe/wgpu"] diff --git a/examples/multiple_viewports/src/main.rs b/examples/multiple_viewports/src/main.rs index 0ef06e7815f..262002e2c5b 100644 --- a/examples/multiple_viewports/src/main.rs +++ b/examples/multiple_viewports/src/main.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use std::sync::{ atomic::{AtomicBool, Ordering}, diff --git a/examples/puffin_profiler/Cargo.toml b/examples/puffin_profiler/Cargo.toml index 6b6acad726d..d787eeb9168 100644 --- a/examples/puffin_profiler/Cargo.toml +++ b/examples/puffin_profiler/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [features] wgpu = ["eframe/wgpu"] diff --git a/examples/puffin_profiler/src/main.rs b/examples/puffin_profiler/src/main.rs index 521184f506b..8fe30d679ff 100644 --- a/examples/puffin_profiler/src/main.rs +++ b/examples/puffin_profiler/src/main.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use std::sync::{ atomic::{AtomicBool, Ordering}, diff --git a/examples/save_plot/Cargo.toml b/examples/save_plot/Cargo.toml index 7c9eb245285..c4c287c001d 100644 --- a/examples/save_plot/Cargo.toml +++ b/examples/save_plot/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ "default", diff --git a/examples/save_plot/src/main.rs b/examples/save_plot/src/main.rs index 3f13d3f28b6..61657faae86 100644 --- a/examples/save_plot/src/main.rs +++ b/examples/save_plot/src/main.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; use egui_plot::{Legend, Line, Plot, PlotPoints}; diff --git a/examples/screenshot/Cargo.toml b/examples/screenshot/Cargo.toml index 0fb5da7fd2a..aba066669c9 100644 --- a/examples/screenshot/Cargo.toml +++ b/examples/screenshot/Cargo.toml @@ -10,6 +10,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ diff --git a/examples/screenshot/src/main.rs b/examples/screenshot/src/main.rs index 91f2f92cfc0..c0c627e86a7 100644 --- a/examples/screenshot/src/main.rs +++ b/examples/screenshot/src/main.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use std::sync::Arc; diff --git a/examples/serial_windows/Cargo.toml b/examples/serial_windows/Cargo.toml index 58d5cdecced..eebd08957af 100644 --- a/examples/serial_windows/Cargo.toml +++ b/examples/serial_windows/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ diff --git a/examples/serial_windows/src/main.rs b/examples/serial_windows/src/main.rs index 57dccaa8b0e..04bed8006ae 100644 --- a/examples/serial_windows/src/main.rs +++ b/examples/serial_windows/src/main.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example use eframe::egui; diff --git a/examples/test_inline_glow_paint/Cargo.toml b/examples/test_inline_glow_paint/Cargo.toml index 893b0d07de1..ae66b6abdd3 100644 --- a/examples/test_inline_glow_paint/Cargo.toml +++ b/examples/test_inline_glow_paint/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/examples/test_inline_glow_paint/src/main.rs b/examples/test_inline_glow_paint/src/main.rs index 1710ee154a6..7851ad63b8b 100644 --- a/examples/test_inline_glow_paint/src/main.rs +++ b/examples/test_inline_glow_paint/src/main.rs @@ -1,3 +1,7 @@ +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example +#![allow(clippy::undocumented_unsafe_blocks)] + // Test that we can paint to the screen using glow directly. use eframe::egui; diff --git a/examples/test_viewports/Cargo.toml b/examples/test_viewports/Cargo.toml index 4e106e37ec8..142bafe2293 100644 --- a/examples/test_viewports/Cargo.toml +++ b/examples/test_viewports/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [features] wgpu = ["eframe/wgpu"] diff --git a/examples/test_viewports/src/main.rs b/examples/test_viewports/src/main.rs index 05679668013..8bbb1b22a07 100644 --- a/examples/test_viewports/src/main.rs +++ b/examples/test_viewports/src/main.rs @@ -1,3 +1,6 @@ +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example + use std::sync::Arc; use eframe::egui; diff --git a/examples/user_attention/Cargo.toml b/examples/user_attention/Cargo.toml index 10f0ce711c0..6c3c91cdc25 100644 --- a/examples/user_attention/Cargo.toml +++ b/examples/user_attention/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" rust-version = "1.76" publish = false +[lints] +workspace = true + [dependencies] eframe = { workspace = true, features = [ "default", diff --git a/examples/user_attention/src/main.rs b/examples/user_attention/src/main.rs index 4625abefa93..cbe27b6d5bc 100644 --- a/examples/user_attention/src/main.rs +++ b/examples/user_attention/src/main.rs @@ -1,3 +1,6 @@ +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release +#![allow(rustdoc::missing_crate_level_docs)] // it's an example + use eframe::{egui, CreationContext, NativeOptions}; use egui::{Button, CentralPanel, Context, UserAttentionType}; diff --git a/scripts/check.sh b/scripts/check.sh index c1852a2d81a..5b802f6c606 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -9,7 +9,6 @@ set -x # Checks all tests, lints etc. # Basically does what the CI does. -cargo install --quiet cargo-cranky # Uses lints defined in Cranky.toml. See https://github.com/ericseppanen/cargo-cranky cargo +1.75.0 install --quiet typos-cli # web_sys_unstable_apis is required to enable the web_sys clipboard API which eframe web uses, @@ -24,7 +23,7 @@ cargo fmt --all -- --check cargo doc --quiet --lib --no-deps --all-features cargo doc --quiet --document-private-items --no-deps --all-features -cargo cranky --quiet --all-targets --all-features -- -D warnings +cargo clippy --quiet --all-targets --all-features -- -D warnings ./scripts/clippy_wasm.sh cargo check --quiet --all-targets diff --git a/scripts/clippy_wasm.sh b/scripts/clippy_wasm.sh index 72f6cc0e53e..3d80bd0f703 100755 --- a/scripts/clippy_wasm.sh +++ b/scripts/clippy_wasm.sh @@ -10,4 +10,4 @@ set -x # Use scripts/clippy_wasm/clippy.toml export CLIPPY_CONF_DIR="scripts/clippy_wasm" -cargo cranky --quiet --all-features --target wasm32-unknown-unknown --target-dir target_wasm -p egui_demo_app --lib -- --deny warnings +cargo clippy --quiet --all-features --target wasm32-unknown-unknown --target-dir target_wasm -p egui_demo_app --lib -- --deny warnings diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index ba5b9382089..26bdbb47e59 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -6,4 +6,7 @@ rust-version.workspace = true version.workspace = true publish = false +[lints] +workspace = true + [dependencies] diff --git a/xtask/src/main.rs b/xtask/src/main.rs index b194629203a..0f16c545427 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -1,3 +1,5 @@ +//! Helper crate for running scripts within the `egui` repo + #![allow(clippy::print_stdout)] #![allow(clippy::print_stderr)] #![allow(clippy::exit)]