Skip to content

Commit

Permalink
Fix clippy::needless_borrow lints
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys committed Dec 24, 2024
1 parent cf024df commit a3c290f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crates/resvg/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ impl FitTo {

fn list_fonts(args: &CliArgs) {
let mut fontdb = fontdb::Database::new();
load_fonts(&args, &mut fontdb);
load_fonts(args, &mut fontdb);

use fontdb::Family;
println!("serif: {}", fontdb.family_name(&Family::Serif));
Expand Down
1 change: 0 additions & 1 deletion crates/resvg/tests/integration/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

use once_cell::sync::Lazy;
use rgb::{FromSlice, RGBA8};
use std::path::Path;
use std::process::Command;
use std::sync::Arc;
use usvg::fontdb;
Expand Down
2 changes: 1 addition & 1 deletion crates/usvg/src/parser/use_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ pub(crate) fn convert_svg(
vb
} else {
// No `viewBox` attribute? Then use `x`, `y`, `width` and `height` instead.
let (mut w, mut h) = use_node_size(node, &state);
let (mut w, mut h) = use_node_size(node, state);

// If attributes `width` and/or `height` are provided on the `use` element,
// then these values will override the corresponding attributes
Expand Down
2 changes: 1 addition & 1 deletion crates/usvg/src/text/flatten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ impl DatabaseExt for Database {
)?;
svg.end_element();

Tree::from_data(&svg.end_document().as_bytes(), &Options::default()).ok()
Tree::from_data(svg.end_document().as_bytes(), &Options::default()).ok()
})?
}
}
16 changes: 8 additions & 8 deletions crates/usvg/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ impl Tree {
if !self
.linear_gradients
.iter()
.any(|other| Arc::ptr_eq(&lg, other))
.any(|other| Arc::ptr_eq(lg, other))
{
self.linear_gradients.push(lg.clone());
}
Expand All @@ -1646,13 +1646,13 @@ impl Tree {
if !self
.radial_gradients
.iter()
.any(|other| Arc::ptr_eq(&rg, other))
.any(|other| Arc::ptr_eq(rg, other))
{
self.radial_gradients.push(rg.clone());
}
}
Paint::Pattern(patt) => {
if !self.patterns.iter().any(|other| Arc::ptr_eq(&patt, other)) {
if !self.patterns.iter().any(|other| Arc::ptr_eq(patt, other)) {
self.patterns.push(patt.clone());
}
}
Expand Down Expand Up @@ -1730,12 +1730,12 @@ impl Group {
for node in self.children() {
if let Node::Group(ref g) = node {
if let Some(ref clip) = g.clip_path {
if !clip_paths.iter().any(|other| Arc::ptr_eq(&clip, other)) {
if !clip_paths.iter().any(|other| Arc::ptr_eq(clip, other)) {
clip_paths.push(clip.clone());
}

if let Some(ref sub_clip) = clip.clip_path {
if !clip_paths.iter().any(|other| Arc::ptr_eq(&sub_clip, other)) {
if !clip_paths.iter().any(|other| Arc::ptr_eq(sub_clip, other)) {
clip_paths.push(sub_clip.clone());
}
}
Expand All @@ -1754,12 +1754,12 @@ impl Group {
for node in self.children() {
if let Node::Group(ref g) = node {
if let Some(ref mask) = g.mask {
if !masks.iter().any(|other| Arc::ptr_eq(&mask, other)) {
if !masks.iter().any(|other| Arc::ptr_eq(mask, other)) {
masks.push(mask.clone());
}

if let Some(ref sub_mask) = mask.mask {
if !masks.iter().any(|other| Arc::ptr_eq(&sub_mask, other)) {
if !masks.iter().any(|other| Arc::ptr_eq(sub_mask, other)) {
masks.push(sub_mask.clone());
}
}
Expand All @@ -1778,7 +1778,7 @@ impl Group {
for node in self.children() {
if let Node::Group(ref g) = node {
for filter in g.filters() {
if !filters.iter().any(|other| Arc::ptr_eq(&filter, other)) {
if !filters.iter().any(|other| Arc::ptr_eq(filter, other)) {
filters.push(filter.clone());
}
}
Expand Down

0 comments on commit a3c290f

Please sign in to comment.