From fda8189cbab18e0acab8db972400e4a4ca0d915e Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 21 Mar 2022 16:54:29 +0100 Subject: [PATCH] Move lints list to `.carg/config.toml` (#1394) That way they apply to all crates equally. See https://github.com/EmbarkStudios/rust-ecosystem/issues/22 for why. --- .cargo/config.toml | 85 +++++++++++++++++++++++++++++++++++ eframe/src/lib.rs | 10 +---- egui-winit/src/lib.rs | 78 -------------------------------- egui/src/lib.rs | 79 -------------------------------- egui_demo_app/src/lib.rs | 5 --- egui_demo_app/src/main.rs | 5 --- egui_demo_lib/src/lib.rs | 79 -------------------------------- egui_extras/src/lib.rs | 79 -------------------------------- egui_glium/src/lib.rs | 79 -------------------------------- egui_web/src/backend.rs | 2 +- egui_web/src/glow_wrapping.rs | 2 +- egui_web/src/lib.rs | 11 ++--- egui_web/src/screen_reader.rs | 1 + egui_web/src/text_agent.rs | 6 +-- emath/src/lib.rs | 79 -------------------------------- epaint/src/lib.rs | 79 -------------------------------- epi/src/lib.rs | 81 --------------------------------- 17 files changed, 96 insertions(+), 664 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 000000000..b809c283f --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,85 @@ +[target.'cfg(all())'] +rustflags = [ + # Global lints/warnings. + # See https://github.com/EmbarkStudios/rust-ecosystem/issues/22 for why we do this here + "-Dunsafe_code", + "-Wclippy::all", + "-Wclippy::await_holding_lock", + "-Wclippy::char_lit_as_u8", + "-Wclippy::checked_conversions", + "-Wclippy::dbg_macro", + "-Wclippy::debug_assert_with_mut_call", + "-Wclippy::disallowed_method", + "-Wclippy::doc_markdown", + "-Wclippy::empty_enum", + "-Wclippy::enum_glob_use", + # "-Wclippy::equatable_if_let", // Enable when we update MSRV + "-Wclippy::exit", + "-Wclippy::expl_impl_clone_on_copy", + "-Wclippy::explicit_deref_methods", + "-Wclippy::explicit_into_iter_loop", + "-Wclippy::fallible_impl_from", + "-Wclippy::filter_map_next", + "-Wclippy::flat_map_option", + "-Wclippy::float_cmp_const", + "-Wclippy::fn_params_excessive_bools", + "-Wclippy::from_iter_instead_of_collect", + "-Wclippy::if_let_mutex", + "-Wclippy::implicit_clone", + "-Wclippy::imprecise_flops", + "-Wclippy::inefficient_to_string", + "-Wclippy::invalid_upcast_comparisons", + # "-Wclippy::iter_not_returning_iterator", // Enable when we update MSRV + "-Wclippy::large_digit_groups", + "-Wclippy::large_stack_arrays", + "-Wclippy::large_types_passed_by_value", + "-Wclippy::let_unit_value", + "-Wclippy::linkedlist", + "-Wclippy::lossy_float_literal", + "-Wclippy::macro_use_imports", + "-Wclippy::manual_ok_or", + "-Wclippy::map_err_ignore", + "-Wclippy::map_flatten", + "-Wclippy::map_unwrap_or", + "-Wclippy::match_on_vec_items", + "-Wclippy::match_same_arms", + "-Wclippy::match_wild_err_arm", + "-Wclippy::match_wildcard_for_single_variants", + "-Wclippy::mem_forget", + "-Wclippy::mismatched_target_os", + "-Wclippy::missing_enforced_import_renames", + "-Wclippy::missing_errors_doc", + "-Wclippy::missing_safety_doc", + # "-Wclippy::mod_module_files", // Enable when we update MSRV + "-Wclippy::mut_mut", + "-Wclippy::mutex_integer", + "-Wclippy::needless_borrow", + "-Wclippy::needless_continue", + "-Wclippy::needless_for_each", + "-Wclippy::needless_pass_by_value", + "-Wclippy::option_option", + "-Wclippy::path_buf_push_overwrite", + "-Wclippy::ptr_as_ptr", + "-Wclippy::rc_mutex", + "-Wclippy::ref_option_ref", + "-Wclippy::rest_pat_in_fully_bound_structs", + "-Wclippy::same_functions_in_if_condition", + "-Wclippy::semicolon_if_nothing_returned", + "-Wclippy::single_match_else", + "-Wclippy::string_add_assign", + "-Wclippy::string_add", + "-Wclippy::string_lit_as_bytes", + "-Wclippy::string_to_string", + "-Wclippy::todo", + "-Wclippy::trait_duplication_in_bounds", + "-Wclippy::unimplemented", + "-Wclippy::unnested_or_patterns", + "-Wclippy::unused_self", + "-Wclippy::useless_transmute", + "-Wclippy::verbose_file_reads", + "-Wclippy::zero_sized_map_values", + "-Wfuture_incompatible", + "-Wnonstandard_style", + "-Wrust_2018_idioms", + "-Wrustdoc::missing_crate_level_docs", +] diff --git a/eframe/src/lib.rs b/eframe/src/lib.rs index 732d60a11..68b060b00 100644 --- a/eframe/src/lib.rs +++ b/eframe/src/lib.rs @@ -58,15 +58,6 @@ //! } //! ``` -// Forbid warnings in release builds: -#![cfg_attr(not(debug_assertions), deny(warnings))] -#![forbid(unsafe_code)] -#![warn( - clippy::all, - missing_docs, - rust_2018_idioms, - rustdoc::missing_crate_level_docs -)] #![allow(clippy::needless_doctest_main)] // Re-export all useful libraries: @@ -143,6 +134,7 @@ pub fn start_web(canvas_id: &str, app_creator: AppCreator) -> Result<(), wasm_bi /// } /// ``` #[cfg(not(target_arch = "wasm32"))] +#[allow(clippy::needless_pass_by_value)] pub fn run_native(app_name: &str, native_options: NativeOptions, app_creator: AppCreator) -> ! { egui_glow::run(app_name, &native_options, app_creator) } diff --git a/egui-winit/src/lib.rs b/egui-winit/src/lib.rs index a4a362200..731724cf2 100644 --- a/egui-winit/src/lib.rs +++ b/egui-winit/src/lib.rs @@ -3,84 +3,6 @@ //! The library translates winit events to egui, handled copy/paste, //! updates the cursor, open links clicked in egui, etc. -#![forbid(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_method, - clippy::doc_markdown, - clippy::empty_enum, - clippy::enum_glob_use, - clippy::exit, - clippy::expl_impl_clone_on_copy, - clippy::explicit_deref_methods, - clippy::explicit_into_iter_loop, - clippy::fallible_impl_from, - clippy::filter_map_next, - clippy::flat_map_option, - clippy::float_cmp_const, - clippy::fn_params_excessive_bools, - clippy::from_iter_instead_of_collect, - clippy::if_let_mutex, - clippy::implicit_clone, - clippy::imprecise_flops, - clippy::inefficient_to_string, - clippy::invalid_upcast_comparisons, - 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_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_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::option_option, - clippy::path_buf_push_overwrite, - clippy::ptr_as_ptr, - 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::string_add_assign, - clippy::string_add, - clippy::string_lit_as_bytes, - clippy::string_to_string, - clippy::todo, - clippy::trait_duplication_in_bounds, - clippy::unimplemented, - clippy::unnested_or_patterns, - clippy::unused_self, - clippy::useless_transmute, - clippy::verbose_file_reads, - clippy::zero_sized_map_values, - future_incompatible, - nonstandard_style, - rust_2018_idioms, - rustdoc::missing_crate_level_docs -)] -#![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] pub use winit; diff --git a/egui/src/lib.rs b/egui/src/lib.rs index c6ab4b0ea..129afaa17 100644 --- a/egui/src/lib.rs +++ b/egui/src/lib.rs @@ -273,85 +273,6 @@ //! # }); //! ``` -// Forbid warnings in release builds: -#![cfg_attr(not(debug_assertions), deny(warnings))] -#![forbid(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_method, - clippy::doc_markdown, - clippy::empty_enum, - clippy::enum_glob_use, - clippy::exit, - clippy::expl_impl_clone_on_copy, - clippy::explicit_deref_methods, - clippy::explicit_into_iter_loop, - clippy::fallible_impl_from, - clippy::filter_map_next, - clippy::flat_map_option, - clippy::float_cmp_const, - clippy::fn_params_excessive_bools, - clippy::from_iter_instead_of_collect, - clippy::if_let_mutex, - clippy::implicit_clone, - clippy::imprecise_flops, - clippy::inefficient_to_string, - clippy::invalid_upcast_comparisons, - 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_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_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::option_option, - clippy::path_buf_push_overwrite, - clippy::ptr_as_ptr, - 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::string_add_assign, - clippy::string_add, - clippy::string_lit_as_bytes, - clippy::string_to_string, - clippy::todo, - clippy::trait_duplication_in_bounds, - clippy::unimplemented, - clippy::unnested_or_patterns, - clippy::unused_self, - clippy::useless_transmute, - clippy::verbose_file_reads, - clippy::zero_sized_map_values, - future_incompatible, - nonstandard_style, - rust_2018_idioms, - rustdoc::missing_crate_level_docs -)] #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] diff --git a/egui_demo_app/src/lib.rs b/egui_demo_app/src/lib.rs index 8d7993356..a4444edf6 100644 --- a/egui_demo_app/src/lib.rs +++ b/egui_demo_app/src/lib.rs @@ -1,8 +1,3 @@ -// Forbid warnings in release builds: -#![cfg_attr(not(debug_assertions), deny(warnings))] -#![forbid(unsafe_code)] -#![warn(clippy::all, rust_2018_idioms)] - #[cfg(target_arch = "wasm32")] use eframe::wasm_bindgen::{self, prelude::*}; diff --git a/egui_demo_app/src/main.rs b/egui_demo_app/src/main.rs index 43d701032..c99e2688a 100644 --- a/egui_demo_app/src/main.rs +++ b/egui_demo_app/src/main.rs @@ -1,10 +1,5 @@ #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release -// Forbid warnings in release builds: -#![cfg_attr(not(debug_assertions), deny(warnings))] -#![forbid(unsafe_code)] -#![warn(clippy::all, rust_2018_idioms)] - // When compiling natively: fn main() { // Log to stdout (if you run with `RUST_LOG=debug`). diff --git a/egui_demo_lib/src/lib.rs b/egui_demo_lib/src/lib.rs index ca15d3482..87e9b2d9a 100644 --- a/egui_demo_lib/src/lib.rs +++ b/egui_demo_lib/src/lib.rs @@ -2,85 +2,6 @@ //! //! The demo-code is also used in benchmarks and tests. -// Forbid warnings in release builds: -#![cfg_attr(not(debug_assertions), deny(warnings))] -#![forbid(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_method, - clippy::doc_markdown, - clippy::empty_enum, - clippy::enum_glob_use, - clippy::exit, - clippy::expl_impl_clone_on_copy, - clippy::explicit_deref_methods, - clippy::explicit_into_iter_loop, - clippy::fallible_impl_from, - clippy::filter_map_next, - clippy::flat_map_option, - clippy::float_cmp_const, - clippy::fn_params_excessive_bools, - clippy::from_iter_instead_of_collect, - clippy::if_let_mutex, - clippy::implicit_clone, - clippy::imprecise_flops, - clippy::inefficient_to_string, - clippy::invalid_upcast_comparisons, - 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_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_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::option_option, - clippy::path_buf_push_overwrite, - clippy::ptr_as_ptr, - 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::string_add_assign, - clippy::string_add, - clippy::string_lit_as_bytes, - clippy::string_to_string, - clippy::todo, - clippy::trait_duplication_in_bounds, - clippy::unimplemented, - clippy::unnested_or_patterns, - clippy::unused_self, - clippy::useless_transmute, - clippy::verbose_file_reads, - clippy::zero_sized_map_values, - future_incompatible, - nonstandard_style, - rust_2018_idioms, - rustdoc::missing_crate_level_docs -)] #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] diff --git a/egui_extras/src/lib.rs b/egui_extras/src/lib.rs index c51f54a8c..c71114423 100644 --- a/egui_extras/src/lib.rs +++ b/egui_extras/src/lib.rs @@ -1,84 +1,5 @@ //! This is a crate that adds some features on top top of [`egui`](https://github.com/emilk/egui). This crate are for experimental features, and features that require big dependencies that does not belong in `egui`. -// Forbid warnings in release builds: -#![cfg_attr(not(debug_assertions), deny(warnings))] -#![forbid(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_method, - clippy::doc_markdown, - clippy::empty_enum, - clippy::enum_glob_use, - clippy::exit, - clippy::expl_impl_clone_on_copy, - clippy::explicit_deref_methods, - clippy::explicit_into_iter_loop, - clippy::fallible_impl_from, - clippy::filter_map_next, - clippy::flat_map_option, - clippy::float_cmp_const, - clippy::fn_params_excessive_bools, - clippy::from_iter_instead_of_collect, - clippy::if_let_mutex, - clippy::implicit_clone, - clippy::imprecise_flops, - clippy::inefficient_to_string, - clippy::invalid_upcast_comparisons, - 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_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_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::option_option, - clippy::path_buf_push_overwrite, - clippy::ptr_as_ptr, - 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::string_add_assign, - clippy::string_add, - clippy::string_lit_as_bytes, - clippy::string_to_string, - clippy::todo, - clippy::trait_duplication_in_bounds, - clippy::unimplemented, - clippy::unnested_or_patterns, - clippy::unused_self, - clippy::useless_transmute, - clippy::verbose_file_reads, - clippy::zero_sized_map_values, - future_incompatible, - nonstandard_style, - rust_2018_idioms, - rustdoc::missing_crate_level_docs -)] #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] diff --git a/egui_glium/src/lib.rs b/egui_glium/src/lib.rs index 1ecfda86a..f5c85e686 100644 --- a/egui_glium/src/lib.rs +++ b/egui_glium/src/lib.rs @@ -4,85 +4,6 @@ //! //! If you are writing an app, you may want to look at [`eframe`](https://docs.rs/eframe) instead. -// Forbid warnings in release builds: -#![cfg_attr(not(debug_assertions), deny(warnings))] -#![forbid(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_method, - clippy::doc_markdown, - clippy::empty_enum, - clippy::enum_glob_use, - clippy::exit, - clippy::expl_impl_clone_on_copy, - clippy::explicit_deref_methods, - clippy::explicit_into_iter_loop, - clippy::fallible_impl_from, - clippy::filter_map_next, - clippy::flat_map_option, - clippy::float_cmp_const, - clippy::fn_params_excessive_bools, - clippy::from_iter_instead_of_collect, - clippy::if_let_mutex, - clippy::implicit_clone, - clippy::imprecise_flops, - clippy::inefficient_to_string, - clippy::invalid_upcast_comparisons, - 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_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_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::option_option, - clippy::path_buf_push_overwrite, - clippy::ptr_as_ptr, - 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::string_add_assign, - clippy::string_add, - clippy::string_lit_as_bytes, - clippy::string_to_string, - clippy::todo, - clippy::trait_duplication_in_bounds, - clippy::unimplemented, - clippy::unnested_or_patterns, - clippy::unused_self, - clippy::useless_transmute, - clippy::verbose_file_reads, - clippy::zero_sized_map_values, - future_incompatible, - nonstandard_style, - rust_2018_idioms, - rustdoc::missing_crate_level_docs -)] #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] diff --git a/egui_web/src/backend.rs b/egui_web/src/backend.rs index 624243502..0ea9c8c08 100644 --- a/egui_web/src/backend.rs +++ b/egui_web/src/backend.rs @@ -66,7 +66,7 @@ fn web_location() -> epi::Location { let query_map = parse_query_map(&query) .iter() - .map(|(k, v)| (k.to_string(), v.to_string())) + .map(|(k, v)| ((*k).to_string(), (*v).to_string())) .collect(); epi::Location { diff --git a/egui_web/src/glow_wrapping.rs b/egui_web/src/glow_wrapping.rs index c589aad14..a66cf5d4d 100644 --- a/egui_web/src/glow_wrapping.rs +++ b/egui_web/src/glow_wrapping.rs @@ -50,7 +50,7 @@ impl WrappedGlowPainter { pub fn clear(&mut self, clear_color: Rgba) { let canvas_dimension = [self.canvas.width(), self.canvas.height()]; - egui_glow::painter::clear(self.painter.gl(), canvas_dimension, clear_color) + egui_glow::painter::clear(self.painter.gl(), canvas_dimension, clear_color); } pub fn paint_primitives( diff --git a/egui_web/src/lib.rs b/egui_web/src/lib.rs index 8bddd04a3..c0bc1905d 100644 --- a/egui_web/src/lib.rs +++ b/egui_web/src/lib.rs @@ -4,10 +4,7 @@ //! //! If you are writing an app, you may want to look at [`eframe`](https://docs.rs/eframe) instead. -// Forbid warnings in release builds: -#![cfg_attr(not(debug_assertions), deny(warnings))] -#![forbid(unsafe_code)] -#![warn(clippy::all, rustdoc::missing_crate_level_docs, rust_2018_idioms)] +#![allow(clippy::missing_errors_doc)] // So many `-> Result<_, JsValue>` pub mod backend; mod glow_wrapping; @@ -891,11 +888,11 @@ pub(crate) fn webgl1_requires_brightening(gl: &web_sys::WebGlRenderingContext) - !user_agent.contains("Mac OS X") && crate::is_safari_and_webkit_gtk(gl) } -/// detecting Safari and webkitGTK. +/// detecting Safari and `webkitGTK`. /// -/// Safari and webkitGTK use unmasked renderer :Apple GPU +/// Safari and `webkitGTK` use unmasked renderer :Apple GPU /// -/// If we detect safari or webkitGTK returns true. +/// If we detect safari or `webkitGTKs` returns true. /// /// This function used to avoid displaying linear color with `sRGB` supported systems. fn is_safari_and_webkit_gtk(gl: &web_sys::WebGlRenderingContext) -> bool { diff --git a/egui_web/src/screen_reader.rs b/egui_web/src/screen_reader.rs index 11c36efdc..e3ac02b1a 100644 --- a/egui_web/src/screen_reader.rs +++ b/egui_web/src/screen_reader.rs @@ -29,6 +29,7 @@ impl Default for ScreenReader { impl ScreenReader { #[cfg(not(feature = "screen_reader"))] + #[allow(clippy::unused_self)] pub fn speak(&mut self, _text: &str) {} #[cfg(feature = "screen_reader")] diff --git a/egui_web/src/text_agent.rs b/egui_web/src/text_agent.rs index ef2af8d89..c73873549 100644 --- a/egui_web/src/text_agent.rs +++ b/egui_web/src/text_agent.rs @@ -161,7 +161,7 @@ pub fn update_text_agent(runner: MutexGuard<'_, AppRunner>) -> Option<()> { let delta = delta.max(-keyboard_fraction); // Don't move it crazy much - let new_pos_percent = (delta * 100.0).round().to_string() + "%"; + let new_pos_percent = format!("{}%", (delta * 100.0).round()); canvas_style.set_property("position", "absolute").ok()?; canvas_style.set_property("top", &new_pos_percent).ok()?; @@ -217,8 +217,8 @@ pub fn move_text_cursor(cursor: Option, canvas_id: &str) -> Option<( let x = (x - canvas.offset_width() as f32 / 2.0) .min(canvas.client_width() as f32 - bounding_rect.width() as f32); style.set_property("position", "absolute").ok()?; - style.set_property("top", &(y.to_string() + "px")).ok()?; - style.set_property("left", &(x.to_string() + "px")).ok() + style.set_property("top", &format!("{}px", y)).ok()?; + style.set_property("left", &format!("{}px", x)).ok() }) } else { style.set_property("position", "absolute").ok()?; diff --git a/emath/src/lib.rs b/emath/src/lib.rs index 97fb41ed2..4f87d9f61 100644 --- a/emath/src/lib.rs +++ b/emath/src/lib.rs @@ -15,85 +15,6 @@ //! For that, use something else ([`glam`](https://docs.rs/glam), [`nalgebra`](https://docs.rs/nalgebra), …) //! and enable the `mint` feature flag in `emath` to enable implicit conversion to/from `emath`. -// Forbid warnings in release builds: -#![cfg_attr(not(debug_assertions), deny(warnings))] -#![forbid(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_method, - clippy::doc_markdown, - clippy::empty_enum, - clippy::enum_glob_use, - clippy::exit, - clippy::expl_impl_clone_on_copy, - clippy::explicit_deref_methods, - clippy::explicit_into_iter_loop, - clippy::fallible_impl_from, - clippy::filter_map_next, - clippy::flat_map_option, - clippy::float_cmp_const, - clippy::fn_params_excessive_bools, - clippy::from_iter_instead_of_collect, - clippy::if_let_mutex, - clippy::implicit_clone, - clippy::imprecise_flops, - clippy::inefficient_to_string, - clippy::invalid_upcast_comparisons, - 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_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_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::option_option, - clippy::path_buf_push_overwrite, - clippy::ptr_as_ptr, - 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::string_add_assign, - clippy::string_add, - clippy::string_lit_as_bytes, - clippy::string_to_string, - clippy::todo, - clippy::trait_duplication_in_bounds, - clippy::unimplemented, - clippy::unnested_or_patterns, - clippy::unused_self, - clippy::useless_transmute, - clippy::verbose_file_reads, - clippy::zero_sized_map_values, - future_incompatible, - nonstandard_style, - rust_2018_idioms, - rustdoc::missing_crate_level_docs -)] #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] diff --git a/epaint/src/lib.rs b/epaint/src/lib.rs index e75d30265..1e27b55f1 100644 --- a/epaint/src/lib.rs +++ b/epaint/src/lib.rs @@ -5,85 +5,6 @@ //! Create some [`Shape`]:s and pass them to [`tessellate_shapes`] to generate [`Mesh`]:es //! that you can then paint using some graphics API of your choice (e.g. OpenGL). -// Forbid warnings in release builds: -#![cfg_attr(not(debug_assertions), deny(warnings))] -#![forbid(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_method, - clippy::doc_markdown, - clippy::empty_enum, - clippy::enum_glob_use, - clippy::exit, - clippy::expl_impl_clone_on_copy, - clippy::explicit_deref_methods, - clippy::explicit_into_iter_loop, - clippy::fallible_impl_from, - clippy::filter_map_next, - clippy::flat_map_option, - clippy::float_cmp_const, - clippy::fn_params_excessive_bools, - clippy::from_iter_instead_of_collect, - clippy::if_let_mutex, - clippy::implicit_clone, - clippy::imprecise_flops, - clippy::inefficient_to_string, - clippy::invalid_upcast_comparisons, - 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_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_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::option_option, - clippy::path_buf_push_overwrite, - clippy::ptr_as_ptr, - 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::string_add_assign, - clippy::string_add, - clippy::string_lit_as_bytes, - clippy::string_to_string, - clippy::todo, - clippy::trait_duplication_in_bounds, - clippy::unimplemented, - clippy::unnested_or_patterns, - clippy::unused_self, - clippy::useless_transmute, - clippy::verbose_file_reads, - clippy::zero_sized_map_values, - future_incompatible, - nonstandard_style, - rust_2018_idioms, - rustdoc::missing_crate_level_docs -)] #![allow(clippy::float_cmp)] #![allow(clippy::manual_range_contains)] diff --git a/epi/src/lib.rs b/epi/src/lib.rs index d1bda8d06..9359cccaf 100644 --- a/epi/src/lib.rs +++ b/epi/src/lib.rs @@ -6,87 +6,6 @@ //! //! Start by looking at the [`App`] trait, and implement [`App::update`]. -// Forbid warnings in release builds: -#![cfg_attr(not(debug_assertions), deny(warnings))] -#![forbid(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_method, - clippy::doc_markdown, - clippy::empty_enum, - clippy::enum_glob_use, - clippy::exit, - clippy::expl_impl_clone_on_copy, - clippy::explicit_deref_methods, - clippy::explicit_into_iter_loop, - clippy::fallible_impl_from, - clippy::filter_map_next, - clippy::flat_map_option, - clippy::float_cmp_const, - clippy::fn_params_excessive_bools, - clippy::from_iter_instead_of_collect, - clippy::if_let_mutex, - clippy::implicit_clone, - clippy::imprecise_flops, - clippy::inefficient_to_string, - clippy::invalid_upcast_comparisons, - 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_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_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::option_option, - clippy::path_buf_push_overwrite, - clippy::ptr_as_ptr, - 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::string_add_assign, - clippy::string_add, - clippy::string_lit_as_bytes, - clippy::string_to_string, - clippy::todo, - clippy::trait_duplication_in_bounds, - clippy::unimplemented, - clippy::unnested_or_patterns, - clippy::unused_self, - clippy::useless_transmute, - clippy::verbose_file_reads, - clippy::zero_sized_map_values, - future_incompatible, - nonstandard_style, - rust_2018_idioms, - rustdoc::missing_crate_level_docs -)] -#![allow(clippy::float_cmp)] -#![allow(clippy::manual_range_contains)] #![warn(missing_docs)] // Let's keep `epi` well-documented. /// File storage which can be used by native backends.