mirror of
https://github.com/penpot/penpot.git
synced 2025-06-01 06:31:39 +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
|
@ -1,4 +1,4 @@
|
|||
use std::collections::HashMap;
|
||||
use std::collections::{hash_map::Entry, HashMap};
|
||||
|
||||
use skia_safe as skia;
|
||||
|
||||
|
@ -24,6 +24,8 @@ use crate::uuid::Uuid;
|
|||
/// state shapes attribute
|
||||
pub(crate) struct ShapesPool {
|
||||
// We need a box so that pushing here doesn't invalidate state.shapes references
|
||||
// FIXME: See if we can avoid this
|
||||
#[allow(clippy::vec_box)]
|
||||
shapes: Vec<Box<Shape>>,
|
||||
counter: usize,
|
||||
}
|
||||
|
@ -116,9 +118,9 @@ impl<'a> State<'a> {
|
|||
}
|
||||
|
||||
pub fn use_shape(&'a mut self, id: Uuid) {
|
||||
if !self.shapes.contains_key(&id) {
|
||||
if let Entry::Vacant(e) = self.shapes.entry(id) {
|
||||
let new_shape = self.shapes_pool.add_shape(id);
|
||||
self.shapes.insert(id, new_shape);
|
||||
e.insert(new_shape);
|
||||
}
|
||||
self.current_id = Some(id);
|
||||
self.current_shape = self.shapes.get_mut(&id).map(|r| &mut **r);
|
||||
|
@ -127,7 +129,7 @@ impl<'a> State<'a> {
|
|||
pub fn delete_shape(&mut self, id: Uuid) {
|
||||
// We don't really do a self.shapes.remove so that redo/undo keep working
|
||||
if let Some(shape) = self.shapes.get(&id) {
|
||||
let (rsx, rsy, rex, rey) = self.render_state.get_tiles_for_shape(&shape);
|
||||
let (rsx, rsy, rex, rey) = self.render_state.get_tiles_for_shape(shape);
|
||||
for x in rsx..=rex {
|
||||
for y in rsy..=rey {
|
||||
let tile = (x, y);
|
||||
|
@ -152,7 +154,7 @@ impl<'a> State<'a> {
|
|||
shape.set_selrect(left, top, right, bottom);
|
||||
// We don't need to update the tile for the root shape.
|
||||
if !shape.id.is_nil() {
|
||||
self.render_state.update_tile_for(&shape);
|
||||
self.render_state.update_tile_for(shape);
|
||||
}
|
||||
}
|
||||
None => panic!("Invalid current shape"),
|
||||
|
@ -165,7 +167,7 @@ impl<'a> State<'a> {
|
|||
// We don't need to update the tile for the root shape.
|
||||
// We can also have deleted the selected shape
|
||||
if !shape.id.is_nil() && self.shapes.contains_key(&shape.id) {
|
||||
self.render_state.update_tile_for(&shape);
|
||||
self.render_state.update_tile_for(shape);
|
||||
}
|
||||
}
|
||||
None => panic!("Invalid current shape"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue