Enable more clippy lints
This commit is contained in:
parent
a7012cf8a6
commit
8e2de26e4e
6 changed files with 25 additions and 22 deletions
|
@ -22,6 +22,7 @@ warn = [
|
|||
"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",
|
||||
|
@ -43,6 +44,7 @@ warn = [
|
|||
"clippy::linkedlist",
|
||||
"clippy::lossy_float_literal",
|
||||
"clippy::macro_use_imports",
|
||||
"clippy::manual_assert",
|
||||
"clippy::manual_ok_or",
|
||||
"clippy::map_err_ignore",
|
||||
"clippy::map_flatten",
|
||||
|
@ -88,14 +90,17 @@ warn = [
|
|||
"clippy::useless_transmute",
|
||||
"clippy::verbose_file_reads",
|
||||
"clippy::zero_sized_map_values",
|
||||
"elided_lifetimes_in_paths",
|
||||
"future_incompatible",
|
||||
"nonstandard_style",
|
||||
"rust_2018_idioms",
|
||||
"rust_2021_prelude_collisions",
|
||||
"rustdoc::missing_crate_level_docs",
|
||||
"semicolon_in_expressions_from_macros",
|
||||
"trivial_numeric_casts",
|
||||
"unused_extern_crates",
|
||||
"unused_import_braces",
|
||||
"unused_lifetimes",
|
||||
# "clippy::cloned_instead_of_copied",
|
||||
# "clippy::mod_module_files",
|
||||
# "trivial_casts",
|
||||
|
|
|
@ -286,7 +286,7 @@ impl TouchState {
|
|||
impl Debug for TouchState {
|
||||
// This outputs less clutter than `#[derive(Debug)]`:
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
for (id, touch) in self.active_touches.iter() {
|
||||
for (id, touch) in &self.active_touches {
|
||||
f.write_fmt(format_args!("#{:?}: {:#?}\n", id, touch))?;
|
||||
}
|
||||
f.write_fmt(format_args!("gesture: {:#?}\n", self.gesture_state))?;
|
||||
|
|
|
@ -90,15 +90,13 @@ impl LineDemo {
|
|||
ComboBox::from_label("Line style")
|
||||
.selected_text(line_style.to_string())
|
||||
.show_ui(ui, |ui| {
|
||||
for style in [
|
||||
for style in &[
|
||||
LineStyle::Solid,
|
||||
LineStyle::dashed_dense(),
|
||||
LineStyle::dashed_loose(),
|
||||
LineStyle::dotted_dense(),
|
||||
LineStyle::dotted_loose(),
|
||||
]
|
||||
.iter()
|
||||
{
|
||||
] {
|
||||
ui.selectable_value(line_style, *style, style.to_string());
|
||||
}
|
||||
});
|
||||
|
|
|
@ -29,10 +29,10 @@ pub fn highlight(ctx: &egui::Context, theme: &CodeTheme, code: &str, language: &
|
|||
}
|
||||
}
|
||||
|
||||
type HighlightCache<'a> = egui::util::cache::FrameCache<LayoutJob, Highlighter>;
|
||||
type HighlightCache = egui::util::cache::FrameCache<LayoutJob, Highlighter>;
|
||||
|
||||
let mut memory = ctx.memory();
|
||||
let highlight_cache = memory.caches.cache::<HighlightCache<'_>>();
|
||||
let highlight_cache = memory.caches.cache::<HighlightCache>();
|
||||
highlight_cache.get((theme, code, language))
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ fn to_decimal_string(v: f64) -> [i32; NUM_DECIMALS] {
|
|||
crate::emath_assert!(v < 10.0, "{:?}", v);
|
||||
let mut digits = [0; NUM_DECIMALS];
|
||||
let mut v = v.abs();
|
||||
for r in digits.iter_mut() {
|
||||
for r in &mut digits {
|
||||
let digit = v.floor();
|
||||
*r = digit as i32;
|
||||
v -= digit;
|
||||
|
|
|
@ -170,25 +170,25 @@ mod rw_lock_impl {
|
|||
}
|
||||
|
||||
pub fn read(&self) -> RwLockReadGuard<'_, T> {
|
||||
if self.lock.is_locked_exclusive() {
|
||||
panic!(
|
||||
assert!(
|
||||
!self.lock.is_locked_exclusive(),
|
||||
"{} DEAD-LOCK DETECTED! Previous lock held at:\n{}\n\n",
|
||||
std::any::type_name::<Self>(),
|
||||
format_backtrace(&mut self.last_lock.lock())
|
||||
);
|
||||
}
|
||||
|
||||
*self.last_lock.lock() = make_backtrace();
|
||||
parking_lot::RwLockReadGuard::map(self.lock.read(), |v| v)
|
||||
}
|
||||
|
||||
pub fn write(&self) -> RwLockWriteGuard<'_, T> {
|
||||
if self.lock.is_locked() {
|
||||
panic!(
|
||||
assert!(
|
||||
!self.lock.is_locked(),
|
||||
"{} DEAD-LOCK DETECTED! Previous lock held at:\n{}\n\n",
|
||||
std::any::type_name::<Self>(),
|
||||
format_backtrace(&mut self.last_lock.lock())
|
||||
);
|
||||
}
|
||||
|
||||
*self.last_lock.lock() = make_backtrace();
|
||||
parking_lot::RwLockWriteGuard::map(self.lock.write(), |v| v)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue