mirror of
https://github.com/penpot/penpot.git
synced 2025-07-17 03:15:16 +02:00
🔧 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:
parent
051c2a7e99
commit
8afd217a80
35 changed files with 447 additions and 2338 deletions
|
@ -25,7 +25,7 @@ fn propagate_children(
|
|||
) -> VecDeque<Modifier> {
|
||||
let children_ids = modified_children_ids(shape, structure.get(&shape.id));
|
||||
|
||||
if children_ids.len() == 0 || identitish(transform) {
|
||||
if children_ids.is_empty() || identitish(transform) {
|
||||
return VecDeque::new();
|
||||
}
|
||||
|
||||
|
@ -67,8 +67,8 @@ fn propagate_children(
|
|||
};
|
||||
|
||||
let transform = constraints::propagate_shape_constraints(
|
||||
&parent_bounds_before,
|
||||
&parent_bounds_after,
|
||||
parent_bounds_before,
|
||||
parent_bounds_after,
|
||||
&child_bounds,
|
||||
constraint_h,
|
||||
constraint_v,
|
||||
|
@ -87,7 +87,7 @@ fn calculate_group_bounds(
|
|||
bounds: &HashMap<Uuid, Bounds>,
|
||||
structure: &HashMap<Uuid, Vec<StructureEntry>>,
|
||||
) -> Option<Bounds> {
|
||||
let shape_bounds = bounds.find(&shape);
|
||||
let shape_bounds = bounds.find(shape);
|
||||
let mut result = Vec::<Point>::new();
|
||||
|
||||
let children_ids = modified_children_ids(shape, structure.get(&shape.id));
|
||||
|
@ -100,12 +100,12 @@ fn calculate_group_bounds(
|
|||
result.append(&mut child_bounds.points());
|
||||
}
|
||||
|
||||
shape_bounds.from_points(result)
|
||||
shape_bounds.with_points(result)
|
||||
}
|
||||
|
||||
pub fn propagate_modifiers(
|
||||
state: &State,
|
||||
modifiers: &Vec<TransformEntry>,
|
||||
modifiers: &[TransformEntry],
|
||||
) -> (Vec<TransformEntry>, HashMap<Uuid, Bounds>) {
|
||||
let shapes = &state.shapes;
|
||||
|
||||
|
@ -115,7 +115,7 @@ pub fn propagate_modifiers(
|
|||
.map(|entry| Modifier::Transform(entry.clone()))
|
||||
.collect();
|
||||
|
||||
for (id, _) in &state.structure {
|
||||
for id in state.structure.keys() {
|
||||
if id != &Uuid::nil() {
|
||||
entries.push_back(Modifier::Reflow(*id));
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ pub fn propagate_modifiers(
|
|||
continue;
|
||||
};
|
||||
|
||||
let shape_bounds_before = bounds.find(&shape);
|
||||
let shape_bounds_before = bounds.find(shape);
|
||||
let mut shape_bounds_after = shape_bounds_before.transform(&entry.transform);
|
||||
|
||||
let mut transform = entry.transform;
|
||||
|
@ -176,9 +176,7 @@ pub fn propagate_modifiers(
|
|||
|
||||
bounds.insert(shape.id, shape_bounds_after);
|
||||
|
||||
let default_matrix = Matrix::default();
|
||||
let mut shape_modif =
|
||||
modifiers.get(&shape.id).unwrap_or(&default_matrix).clone();
|
||||
let mut shape_modif = modifiers.get(&shape.id).copied().unwrap_or_default();
|
||||
shape_modif.post_concat(&transform);
|
||||
modifiers.insert(shape.id, shape_modif);
|
||||
|
||||
|
@ -230,7 +228,7 @@ pub fn propagate_modifiers(
|
|||
let children_ids =
|
||||
modified_children_ids(shape, state.structure.get(&shape.id));
|
||||
if let Some(child) = shapes.get(&children_ids[0]) {
|
||||
let child_bounds = bounds.find(&child);
|
||||
let child_bounds = bounds.find(child);
|
||||
bounds.insert(shape.id, child_bounds);
|
||||
reflow_parent = true;
|
||||
}
|
||||
|
@ -269,11 +267,11 @@ pub fn propagate_modifiers(
|
|||
}
|
||||
|
||||
for id in layout_reflows.iter() {
|
||||
if reflown.contains(&id) {
|
||||
if reflown.contains(id) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let Some(shape) = state.shapes.get(&id) else {
|
||||
let Some(shape) = state.shapes.get(id) else {
|
||||
continue;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue