🔧 Enable back clippy rules (#6492)

* 🔧 Fix lint script (rust)

* 🔧 Temporarily add clippy rules to ignore so lint script passes

* 💄 Fix clippy rule crate_in_macro_def

* 💄 Fix clippy rule redundant-static-lifetimes

* 💄 Fix clippy rule unnecessary_cast

* 💄 Fix clippy rule nonminimal_bool

* 💄 Fix clippy rule redundant_pattern_matching

* 💄 Fix clippy rule assign_op_pattern

* 💄 Fix clippy rule needless_lifetimes

* 💄 Fix clippy rule for_kv_map

* 💄 Fix clippy rule ptr_arg

* 💄 Fix clippy rule match_like_matches_macro

* 💄 Fix clippy rule macro_metavars_in_unsafe

* 💄 Fix clippy rule map_clone

* 💄 Fix clippy rule wrong_self_convention

* 💄 Fix clippy rule vec_box

* 💄 Fix clippy rule useless_format

* 💄 Fix clippy rule unwrap_or_default

* 💄 Fix clippy rule unused_unit

* 💄 Fix clippy rule unnecessary_to_owned

* 💄 Fix clippy rule too_many_arguments

* 💄 Fix clippy rule slow_vector_initialization

* 💄 Fix clippy rule single_match

* 💄 Fix clippy rule redundant_field_names

* 💄 Fix clippy rule rendudant_closure

* 💄 Fix clippy rule needless_return

* 💄 Fix clippy rule needless_range_loop

* 💄 Fix clippy rule needless_borrows_for_generic_args

* 💄 Fix clippy rule needless-borrow

* 💄 Fix clippy rule missing_transmute_annotations

* 💄 Fix clippy rule map_entry

* 💄 Fix clippy rule manual_map

* 💄 Fix clippy rule len_zero

* 💄 Fix clippy rule from_over_into

* 💄 Fix clippy rule field_reassign_with_default

* 💄 Fix clippy rule enum_variant_names

* 💄 Fix clippy rule derivable_impls

* 💄 Fix clippy rule clone_on_copy

* 💄 Fix clippy rule box_collection

* 🔧 Make lint script also check test config target

* 🔧 Remove cargo-watch as a lib dependency

* 💄 Fix clippy rule for join_bounds

* 🔧 Fix lint script return code

---------

Co-authored-by: alonso.torres <alonso.torres@kaleidos.net>
This commit is contained in:
Belén Albeza 2025-05-19 11:14:55 +02:00 committed by GitHub
parent 051c2a7e99
commit 8afd217a80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
35 changed files with 447 additions and 2338 deletions

View file

@ -64,7 +64,7 @@ impl Bounds {
Self { nw, ne, se, sw }
}
pub fn join_bounds(bounds: &Vec<&Bounds>) -> Self {
pub fn join_bounds(bounds: &[&Bounds]) -> Self {
let (min_x, min_y, max_x, max_y) =
bounds
.iter()
@ -133,11 +133,13 @@ impl Bounds {
self.sw = mtx.map_point(self.sw);
}
// FIXME: this looks like this should be a try_from static method or similar
pub fn box_bounds(&self, other: &Self) -> Option<Self> {
self.from_points(other.points())
self.with_points(other.points())
}
pub fn from_points(&self, points: Vec<Point>) -> Option<Self> {
// FIXME: this looks like this should be a try_from static method or similar
pub fn with_points(&self, points: Vec<Point>) -> Option<Self> {
let hv = self.horizontal_vec();
let vv = self.vertical_vec();
@ -312,17 +314,17 @@ impl Bounds {
// TODO: Probably we can improve performance here removing the access
pub fn flip_x(&self) -> bool {
let m = self.transform_matrix().unwrap_or(Matrix::default());
let m = self.transform_matrix().unwrap_or_default();
m.scale_x() < 0.0
}
// TODO: Probably we can improve performance here removing the access
pub fn flip_y(&self) -> bool {
let m = self.transform_matrix().unwrap_or(Matrix::default());
let m = self.transform_matrix().unwrap_or_default();
m.scale_y() < 0.0
}
pub fn to_rect(&self) -> Rect {
pub fn to_rect(self) -> Rect {
Rect::from_ltrb(self.min_x(), self.min_y(), self.max_x(), self.max_y())
}
@ -387,11 +389,7 @@ pub fn intersect_rays_t(ray1: &Ray, ray2: &Ray) -> Option<f32> {
}
pub fn intersect_rays(ray1: &Ray, ray2: &Ray) -> Option<Point> {
if let Some(t) = intersect_rays_t(ray1, ray2) {
Some(ray1.t(t))
} else {
None
}
intersect_rays_t(ray1, ray2).map(|t| ray1.t(t))
}
/*
@ -409,9 +407,7 @@ pub fn resize_matrix(
let scale_height = new_height / child_bounds.height();
let center = child_bounds.center();
let mut parent_transform = parent_bounds
.transform_matrix()
.unwrap_or(Matrix::default());
let mut parent_transform = parent_bounds.transform_matrix().unwrap_or_default();
parent_transform.post_translate(center);
parent_transform.pre_translate(-center);
@ -423,7 +419,7 @@ pub fn resize_matrix(
scale.post_translate(origin);
scale.post_concat(&parent_transform);
scale.pre_translate(-origin);
scale.pre_concat(&parent_transform_inv);
scale.pre_concat(parent_transform_inv);
result.post_concat(&scale);
result
}