Add some clippy lints
This commit is contained in:
parent
25c5e9d94e
commit
fd3444473f
10 changed files with 87 additions and 41 deletions
|
@ -327,7 +327,6 @@ impl WidgetInfo {
|
|||
|
||||
// TODO: localization
|
||||
let widget_name = match typ {
|
||||
WidgetType::Label => "",
|
||||
WidgetType::Hyperlink => "link",
|
||||
WidgetType::TextEdit => "text edit",
|
||||
WidgetType::Button => "button",
|
||||
|
@ -340,7 +339,7 @@ impl WidgetInfo {
|
|||
WidgetType::ColorButton => "color button",
|
||||
WidgetType::ImageButton => "image button",
|
||||
WidgetType::CollapsingHeader => "collapsing header",
|
||||
WidgetType::Other => "",
|
||||
WidgetType::Label | WidgetType::Other => "",
|
||||
};
|
||||
|
||||
let mut description = widget_name.to_owned();
|
||||
|
|
|
@ -138,6 +138,7 @@ impl GridLayout {
|
|||
Rect::from_min_size(cursor.min, size)
|
||||
}
|
||||
|
||||
#[allow(clippy::unused_self)]
|
||||
pub(crate) fn align_size_within_rect(&self, size: Vec2, frame: Rect) -> Rect {
|
||||
// TODO: allow this alignment to be customized
|
||||
Align2::LEFT_CENTER.align_size_within_rect(size, frame)
|
||||
|
|
|
@ -233,19 +233,26 @@
|
|||
clippy::all,
|
||||
clippy::await_holding_lock,
|
||||
clippy::dbg_macro,
|
||||
clippy::debug_assert_with_mut_call,
|
||||
clippy::doc_markdown,
|
||||
clippy::empty_enum,
|
||||
clippy::enum_glob_use,
|
||||
clippy::exit,
|
||||
clippy::explicit_into_iter_loop,
|
||||
clippy::filter_map_next,
|
||||
clippy::fn_params_excessive_bools,
|
||||
clippy::if_let_mutex,
|
||||
clippy::imprecise_flops,
|
||||
clippy::inefficient_to_string,
|
||||
clippy::large_types_passed_by_value,
|
||||
clippy::let_unit_value,
|
||||
clippy::linkedlist,
|
||||
clippy::lossy_float_literal,
|
||||
clippy::macro_use_imports,
|
||||
clippy::map_err_ignore,
|
||||
clippy::map_flatten,
|
||||
clippy::match_on_vec_items,
|
||||
clippy::match_same_arms,
|
||||
clippy::match_wildcard_for_single_variants,
|
||||
clippy::mem_forget,
|
||||
clippy::mismatched_target_os,
|
||||
|
@ -256,18 +263,20 @@
|
|||
clippy::needless_pass_by_value,
|
||||
clippy::option_option,
|
||||
clippy::pub_enum_variant_names,
|
||||
clippy::ref_option_ref,
|
||||
clippy::rest_pat_in_fully_bound_structs,
|
||||
clippy::string_add_assign,
|
||||
clippy::string_add,
|
||||
clippy::string_to_string,
|
||||
clippy::todo,
|
||||
clippy::unimplemented,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::unused_self,
|
||||
clippy::verbose_file_reads,
|
||||
future_incompatible,
|
||||
missing_crate_level_docs,
|
||||
missing_doc_code_examples,
|
||||
// missing_docs,
|
||||
nonstandard_style,
|
||||
rust_2018_idioms,
|
||||
unused_doc_comments,
|
||||
rust_2018_idioms
|
||||
)]
|
||||
#![allow(clippy::manual_range_contains)]
|
||||
|
||||
|
|
|
@ -303,6 +303,7 @@ fn x_range(rect: &Rect) -> RangeInclusive<f32> {
|
|||
|
||||
impl<'a> Slider<'a> {
|
||||
/// Just the slider, no text
|
||||
#[allow(clippy::unused_self)]
|
||||
fn allocate_slider_space(&self, ui: &mut Ui, height: f32) -> Response {
|
||||
let desired_size = vec2(ui.spacing().slider_width, height);
|
||||
ui.allocate_response(desired_size, Sense::click_and_drag())
|
||||
|
|
|
@ -57,7 +57,7 @@ impl super::View for LayoutTest {
|
|||
ui.available_size_before_wrap_finite().x,
|
||||
self.wrap_row_height,
|
||||
),
|
||||
|ui| ui.with_layout(self.layout(), |ui| self.demo_ui(ui)),
|
||||
|ui| ui.with_layout(self.layout(), demo_ui),
|
||||
);
|
||||
} else {
|
||||
ui.allocate_ui(
|
||||
|
@ -65,11 +65,11 @@ impl super::View for LayoutTest {
|
|||
self.wrap_column_width,
|
||||
ui.available_size_before_wrap_finite().y,
|
||||
),
|
||||
|ui| ui.with_layout(self.layout(), |ui| self.demo_ui(ui)),
|
||||
|ui| ui.with_layout(self.layout(), demo_ui),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
ui.with_layout(self.layout(), |ui| self.demo_ui(ui));
|
||||
ui.with_layout(self.layout(), demo_ui);
|
||||
}
|
||||
});
|
||||
ui.label("Resize to see effect");
|
||||
|
@ -138,8 +138,9 @@ impl LayoutTest {
|
|||
ui.checkbox(&mut self.cross_justify, "Cross Justified")
|
||||
.on_hover_text("Try to fill full width/height (e.g. buttons)");
|
||||
}
|
||||
}
|
||||
|
||||
pub fn demo_ui(&mut self, ui: &mut Ui) {
|
||||
fn demo_ui(ui: &mut Ui) {
|
||||
ui.monospace("Example widgets:");
|
||||
for _ in 0..3 {
|
||||
ui.label("label");
|
||||
|
@ -152,4 +153,3 @@ impl LayoutTest {
|
|||
let _ = ui.button("button");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,19 +8,26 @@
|
|||
clippy::all,
|
||||
clippy::await_holding_lock,
|
||||
clippy::dbg_macro,
|
||||
clippy::debug_assert_with_mut_call,
|
||||
clippy::doc_markdown,
|
||||
clippy::empty_enum,
|
||||
clippy::enum_glob_use,
|
||||
clippy::exit,
|
||||
clippy::explicit_into_iter_loop,
|
||||
clippy::filter_map_next,
|
||||
clippy::fn_params_excessive_bools,
|
||||
clippy::if_let_mutex,
|
||||
clippy::imprecise_flops,
|
||||
clippy::inefficient_to_string,
|
||||
clippy::large_types_passed_by_value,
|
||||
clippy::let_unit_value,
|
||||
clippy::linkedlist,
|
||||
clippy::lossy_float_literal,
|
||||
clippy::macro_use_imports,
|
||||
clippy::map_err_ignore,
|
||||
clippy::map_flatten,
|
||||
clippy::match_on_vec_items,
|
||||
clippy::match_same_arms,
|
||||
clippy::match_wildcard_for_single_variants,
|
||||
clippy::mem_forget,
|
||||
clippy::mismatched_target_os,
|
||||
|
@ -31,19 +38,22 @@
|
|||
clippy::needless_pass_by_value,
|
||||
clippy::option_option,
|
||||
clippy::pub_enum_variant_names,
|
||||
clippy::ref_option_ref,
|
||||
clippy::rest_pat_in_fully_bound_structs,
|
||||
clippy::string_add_assign,
|
||||
clippy::string_add,
|
||||
clippy::string_to_string,
|
||||
clippy::todo,
|
||||
clippy::unimplemented,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::unused_self,
|
||||
clippy::verbose_file_reads,
|
||||
future_incompatible,
|
||||
missing_crate_level_docs,
|
||||
missing_doc_code_examples,
|
||||
// missing_docs,
|
||||
nonstandard_style,
|
||||
rust_2018_idioms,
|
||||
unused_doc_comments,
|
||||
rust_2018_idioms
|
||||
)]
|
||||
#![allow(clippy::manual_range_contains)]
|
||||
|
||||
mod apps;
|
||||
pub(crate) mod frame_history;
|
||||
|
|
|
@ -15,19 +15,26 @@
|
|||
clippy::all,
|
||||
clippy::await_holding_lock,
|
||||
clippy::dbg_macro,
|
||||
clippy::debug_assert_with_mut_call,
|
||||
clippy::doc_markdown,
|
||||
clippy::empty_enum,
|
||||
clippy::enum_glob_use,
|
||||
clippy::exit,
|
||||
clippy::explicit_into_iter_loop,
|
||||
clippy::filter_map_next,
|
||||
clippy::fn_params_excessive_bools,
|
||||
clippy::if_let_mutex,
|
||||
clippy::imprecise_flops,
|
||||
clippy::inefficient_to_string,
|
||||
clippy::large_types_passed_by_value,
|
||||
clippy::let_unit_value,
|
||||
clippy::linkedlist,
|
||||
clippy::lossy_float_literal,
|
||||
clippy::macro_use_imports,
|
||||
clippy::map_err_ignore,
|
||||
clippy::map_flatten,
|
||||
clippy::match_on_vec_items,
|
||||
clippy::match_same_arms,
|
||||
clippy::match_wildcard_for_single_variants,
|
||||
clippy::mem_forget,
|
||||
clippy::mismatched_target_os,
|
||||
|
@ -38,18 +45,20 @@
|
|||
clippy::needless_pass_by_value,
|
||||
clippy::option_option,
|
||||
clippy::pub_enum_variant_names,
|
||||
clippy::ref_option_ref,
|
||||
clippy::rest_pat_in_fully_bound_structs,
|
||||
clippy::string_add_assign,
|
||||
clippy::string_add,
|
||||
clippy::string_to_string,
|
||||
clippy::todo,
|
||||
clippy::unimplemented,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::unused_self,
|
||||
clippy::verbose_file_reads,
|
||||
future_incompatible,
|
||||
missing_crate_level_docs,
|
||||
missing_doc_code_examples,
|
||||
// missing_docs,
|
||||
nonstandard_style,
|
||||
rust_2018_idioms,
|
||||
unused_doc_comments,
|
||||
rust_2018_idioms
|
||||
)]
|
||||
#![allow(clippy::manual_range_contains)]
|
||||
|
||||
|
|
|
@ -6,19 +6,26 @@
|
|||
clippy::all,
|
||||
clippy::await_holding_lock,
|
||||
clippy::dbg_macro,
|
||||
clippy::debug_assert_with_mut_call,
|
||||
clippy::doc_markdown,
|
||||
clippy::empty_enum,
|
||||
clippy::enum_glob_use,
|
||||
clippy::exit,
|
||||
clippy::explicit_into_iter_loop,
|
||||
clippy::filter_map_next,
|
||||
clippy::fn_params_excessive_bools,
|
||||
clippy::if_let_mutex,
|
||||
clippy::imprecise_flops,
|
||||
clippy::inefficient_to_string,
|
||||
clippy::large_types_passed_by_value,
|
||||
clippy::let_unit_value,
|
||||
clippy::linkedlist,
|
||||
clippy::lossy_float_literal,
|
||||
clippy::macro_use_imports,
|
||||
clippy::map_err_ignore,
|
||||
clippy::map_flatten,
|
||||
clippy::match_on_vec_items,
|
||||
clippy::match_same_arms,
|
||||
clippy::match_wildcard_for_single_variants,
|
||||
clippy::mem_forget,
|
||||
clippy::mismatched_target_os,
|
||||
|
@ -29,18 +36,20 @@
|
|||
clippy::needless_pass_by_value,
|
||||
clippy::option_option,
|
||||
clippy::pub_enum_variant_names,
|
||||
clippy::ref_option_ref,
|
||||
clippy::rest_pat_in_fully_bound_structs,
|
||||
clippy::string_add_assign,
|
||||
clippy::string_add,
|
||||
clippy::string_to_string,
|
||||
clippy::todo,
|
||||
clippy::unimplemented,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::unused_self,
|
||||
clippy::verbose_file_reads,
|
||||
future_incompatible,
|
||||
missing_crate_level_docs,
|
||||
missing_doc_code_examples,
|
||||
// missing_docs,
|
||||
nonstandard_style,
|
||||
rust_2018_idioms,
|
||||
unused_doc_comments,
|
||||
rust_2018_idioms
|
||||
)]
|
||||
#![allow(clippy::manual_range_contains)]
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use crate::*;
|
||||
|
||||
pub fn adjust_colors(shape: &mut Shape, adjust_color: &impl Fn(&mut Color32)) {
|
||||
#![allow(clippy::match_same_arms)]
|
||||
match shape {
|
||||
Shape::Noop => {}
|
||||
Shape::Vec(shapes) => {
|
||||
|
|
|
@ -12,19 +12,26 @@
|
|||
clippy::all,
|
||||
clippy::await_holding_lock,
|
||||
clippy::dbg_macro,
|
||||
clippy::debug_assert_with_mut_call,
|
||||
clippy::doc_markdown,
|
||||
clippy::empty_enum,
|
||||
clippy::enum_glob_use,
|
||||
clippy::exit,
|
||||
clippy::explicit_into_iter_loop,
|
||||
clippy::filter_map_next,
|
||||
clippy::fn_params_excessive_bools,
|
||||
clippy::if_let_mutex,
|
||||
clippy::imprecise_flops,
|
||||
clippy::inefficient_to_string,
|
||||
clippy::large_types_passed_by_value,
|
||||
clippy::let_unit_value,
|
||||
clippy::linkedlist,
|
||||
clippy::lossy_float_literal,
|
||||
clippy::macro_use_imports,
|
||||
clippy::map_err_ignore,
|
||||
clippy::map_flatten,
|
||||
clippy::match_on_vec_items,
|
||||
clippy::match_same_arms,
|
||||
clippy::match_wildcard_for_single_variants,
|
||||
clippy::mem_forget,
|
||||
clippy::mismatched_target_os,
|
||||
|
@ -35,18 +42,22 @@
|
|||
clippy::needless_pass_by_value,
|
||||
clippy::option_option,
|
||||
clippy::pub_enum_variant_names,
|
||||
clippy::ref_option_ref,
|
||||
clippy::rest_pat_in_fully_bound_structs,
|
||||
clippy::string_add_assign,
|
||||
clippy::string_add,
|
||||
clippy::string_to_string,
|
||||
clippy::todo,
|
||||
clippy::unimplemented,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::unused_self,
|
||||
clippy::verbose_file_reads,
|
||||
future_incompatible,
|
||||
missing_crate_level_docs,
|
||||
missing_doc_code_examples,
|
||||
missing_docs,
|
||||
rust_2018_idioms,
|
||||
unused_doc_comments
|
||||
nonstandard_style,
|
||||
rust_2018_idioms
|
||||
)]
|
||||
#![allow(clippy::manual_range_contains)]
|
||||
|
||||
pub use egui; // Re-export for user convenience
|
||||
|
||||
|
@ -172,10 +183,6 @@ impl<'a> Frame<'a> {
|
|||
self.0.output.window_size = Some(size);
|
||||
}
|
||||
|
||||
/// Use [`egui::Context::set_pixels_per_point`] instead
|
||||
#[deprecated = "Use egui::Context::set_pixels_per_point instead"]
|
||||
pub fn set_pixels_per_point(&mut self, _: f32) {}
|
||||
|
||||
/// If you need to request a repaint from another thread, clone this and send it to that other thread.
|
||||
pub fn repaint_signal(&self) -> std::sync::Arc<dyn RepaintSignal> {
|
||||
self.0.repaint_signal.clone()
|
||||
|
|
Loading…
Reference in a new issue