diff --git a/egui/src/context.rs b/egui/src/context.rs index fdcf63bdccf..deeb16fba76 100644 --- a/egui/src/context.rs +++ b/egui/src/context.rs @@ -58,7 +58,7 @@ impl std::ops::Deref for CtxRef { type Target = Context; fn deref(&self) -> &Context { - self.0.deref() + &*self.0 } } diff --git a/egui/src/lib.rs b/egui/src/lib.rs index 612b60fc3a8..55f57050c63 100644 --- a/egui/src/lib.rs +++ b/egui/src/lib.rs @@ -252,23 +252,31 @@ #![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::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::float_cmp_const, clippy::fn_params_excessive_bools, clippy::if_let_mutex, clippy::imprecise_flops, clippy::inefficient_to_string, + clippy::invalid_upcast_comparisons, 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::match_on_vec_items, @@ -278,21 +286,31 @@ 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_pass_by_value, clippy::option_option, + clippy::path_buf_push_overwrite, + clippy::ptr_as_ptr, clippy::pub_enum_variant_names, clippy::ref_option_ref, clippy::rest_pat_in_fully_bound_structs, + clippy::same_functions_in_if_condition, 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::wrong_pub_self_convention, + clippy::zero_sized_map_values, future_incompatible, nonstandard_style, rust_2018_idioms diff --git a/egui_demo_lib/src/lib.rs b/egui_demo_lib/src/lib.rs index 2571285ce97..a9884452ce2 100644 --- a/egui_demo_lib/src/lib.rs +++ b/egui_demo_lib/src/lib.rs @@ -13,23 +13,31 @@ #![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::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::float_cmp_const, clippy::fn_params_excessive_bools, clippy::if_let_mutex, clippy::imprecise_flops, clippy::inefficient_to_string, + clippy::invalid_upcast_comparisons, 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::match_on_vec_items, @@ -39,21 +47,31 @@ 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_pass_by_value, clippy::option_option, + clippy::path_buf_push_overwrite, + clippy::ptr_as_ptr, clippy::pub_enum_variant_names, clippy::ref_option_ref, clippy::rest_pat_in_fully_bound_structs, + clippy::same_functions_in_if_condition, 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::wrong_pub_self_convention, + clippy::zero_sized_map_values, future_incompatible, nonstandard_style, rust_2018_idioms diff --git a/emath/src/lib.rs b/emath/src/lib.rs index 496daaa08ac..683c238a65d 100644 --- a/emath/src/lib.rs +++ b/emath/src/lib.rs @@ -20,23 +20,31 @@ #![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::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::float_cmp_const, clippy::fn_params_excessive_bools, clippy::if_let_mutex, clippy::imprecise_flops, clippy::inefficient_to_string, + clippy::invalid_upcast_comparisons, 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::match_on_vec_items, @@ -46,21 +54,31 @@ 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_pass_by_value, clippy::option_option, + clippy::path_buf_push_overwrite, + clippy::ptr_as_ptr, clippy::pub_enum_variant_names, clippy::ref_option_ref, clippy::rest_pat_in_fully_bound_structs, + clippy::same_functions_in_if_condition, 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::wrong_pub_self_convention, + clippy::zero_sized_map_values, future_incompatible, nonstandard_style, rust_2018_idioms diff --git a/epaint/src/lib.rs b/epaint/src/lib.rs index c2156c87710..5d80b8fad92 100644 --- a/epaint/src/lib.rs +++ b/epaint/src/lib.rs @@ -11,23 +11,31 @@ #![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::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::float_cmp_const, clippy::fn_params_excessive_bools, clippy::if_let_mutex, clippy::imprecise_flops, clippy::inefficient_to_string, + clippy::invalid_upcast_comparisons, 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::match_on_vec_items, @@ -37,21 +45,31 @@ 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_pass_by_value, clippy::option_option, + clippy::path_buf_push_overwrite, + clippy::ptr_as_ptr, clippy::pub_enum_variant_names, clippy::ref_option_ref, clippy::rest_pat_in_fully_bound_structs, + clippy::same_functions_in_if_condition, 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::wrong_pub_self_convention, + clippy::zero_sized_map_values, future_incompatible, nonstandard_style, rust_2018_idioms diff --git a/epaint/src/mesh.rs b/epaint/src/mesh.rs index 58abdc413a0..9c273ac6ed9 100644 --- a/epaint/src/mesh.rs +++ b/epaint/src/mesh.rs @@ -60,8 +60,8 @@ impl Mesh { /// Are all indices within the bounds of the contained vertices? pub fn is_valid(&self) -> bool { - if self.vertices.len() <= u32::MAX as usize { - let n = self.vertices.len() as u32; + use std::convert::TryFrom; + if let Ok(n) = u32::try_from(self.vertices.len()) { self.indices.iter().all(|&i| i < n) } else { false @@ -255,8 +255,8 @@ pub struct Mesh16 { impl Mesh16 { /// Are all indices within the bounds of the contained vertices? pub fn is_valid(&self) -> bool { - if self.vertices.len() <= u16::MAX as usize { - let n = self.vertices.len() as u16; + use std::convert::TryFrom; + if let Ok(n) = u16::try_from(self.vertices.len()) { self.indices.iter().all(|&i| i < n) } else { false diff --git a/epi/src/lib.rs b/epi/src/lib.rs index 329ed967703..741427da3de 100644 --- a/epi/src/lib.rs +++ b/epi/src/lib.rs @@ -17,23 +17,31 @@ #![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::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::float_cmp_const, clippy::fn_params_excessive_bools, clippy::if_let_mutex, clippy::imprecise_flops, clippy::inefficient_to_string, + clippy::invalid_upcast_comparisons, 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::match_on_vec_items, @@ -43,21 +51,31 @@ 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_pass_by_value, clippy::option_option, + clippy::path_buf_push_overwrite, + clippy::ptr_as_ptr, clippy::pub_enum_variant_names, clippy::ref_option_ref, clippy::rest_pat_in_fully_bound_structs, + clippy::same_functions_in_if_condition, 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::wrong_pub_self_convention, + clippy::zero_sized_map_values, future_incompatible, nonstandard_style, rust_2018_idioms diff --git a/sh/check.sh b/sh/check.sh index 03e06491bde..bce9335d241 100755 --- a/sh/check.sh +++ b/sh/check.sh @@ -11,7 +11,7 @@ cargo test --workspace --doc cargo check --workspace --all-targets --all-features cargo check -p egui_demo_app --lib --target wasm32-unknown-unknown cargo check -p egui_demo_app --lib --target wasm32-unknown-unknown --all-features -CARGO_INCREMENTAL=0 cargo clippy --workspace --all-targets --all-features -- -D warnings -W clippy::all +cargo clippy --workspace --all-targets --all-features -- -D warnings -W clippy::all cargo test --workspace --all-targets --all-features cargo fmt --all -- --check