[librsvg: 4/12] Clear useless_vec, needless_borrow and unreadable_literal.



commit 7c2c26451e123b930ab9e9c17c7b078caadd1049
Author: Jordan Petridis <jordanpetridis protonmail com>
Date:   Sun Dec 17 09:29:23 2017 +0200

    Clear useless_vec, needless_borrow and unreadable_literal.
    
    For more see:
    https://rust-lang-nursery.github.io/rust-clippy/v0.0.176/index.html#useless_vec
    https://rust-lang-nursery.github.io/rust-clippy/v0.0.176/index.html#needless_borrow
    https://rust-lang-nursery.github.io/rust-clippy/v0.0.176/index.html#unreadable_literal

 rust/src/color.rs    | 8 ++++----
 rust/src/error.rs    | 4 ++--
 rust/src/gradient.rs | 2 +-
 rust/src/image.rs    | 2 +-
 rust/src/marker.rs   | 2 +-
 rust/src/shapes.rs   | 2 +-
 6 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/rust/src/color.rs b/rust/src/color.rs
index 5e12892..3aa0aff 100644
--- a/rust/src/color.rs
+++ b/rust/src/color.rs
@@ -108,10 +108,10 @@ impl Color {
 }
 
 fn rgba_from_argb (argb: u32) -> cssparser::RGBA {
-    cssparser::RGBA::new (((argb & 0x00ff0000) >> 16) as u8,
-                          ((argb & 0x0000ff00) >> 8) as u8,
-                          ((argb & 0x000000ff) as u8),
-                          ((argb & 0xff000000) >> 24) as u8)
+    cssparser::RGBA::new (((argb & 0x00ff_0000) >> 16) as u8,
+                          ((argb & 0x0000_ff00) >> 8) as u8,
+                          ((argb & 0x0000_00ff) as u8),
+                          ((argb & 0xff00_0000) >> 24) as u8)
 }
 
 impl From<cssparser::Color> for Color {
diff --git a/rust/src/error.rs b/rust/src/error.rs
index f3b7eb4..4abfdc8 100644
--- a/rust/src/error.rs
+++ b/rust/src/error.rs
@@ -44,8 +44,8 @@ impl NodeError {
 impl error::Error for NodeError {
     fn description (&self) -> &str {
         match self.err {
-            AttributeError::Parse (_) => &"parse error",
-            AttributeError::Value (_) => &"invalid attribute value"
+            AttributeError::Parse (_) => "parse error",
+            AttributeError::Value (_) => "invalid attribute value"
         }
     }
 }
diff --git a/rust/src/gradient.rs b/rust/src/gradient.rs
index 9b89270..1c09baf 100644
--- a/rust/src/gradient.rs
+++ b/rust/src/gradient.rs
@@ -641,7 +641,7 @@ pub extern fn gradient_resolve_fallbacks_and_set_pattern (raw_node:     *const R
     let mut did_set_gradient = false;
 
     node.with_impl (|node_gradient: &NodeGradient| {
-        let gradient = node_gradient.get_gradient_with_color_stops_from_node (&node);
+        let gradient = node_gradient.get_gradient_with_color_stops_from_node (node);
         did_set_gradient = resolve_fallbacks_and_set_pattern (&gradient, draw_ctx, opacity, bbox);
     });
 
diff --git a/rust/src/image.rs b/rust/src/image.rs
index c1da15b..c584d58 100644
--- a/rust/src/image.rs
+++ b/rust/src/image.rs
@@ -107,7 +107,7 @@ impl NodeTrait for NodeImage {
                                                f64::from(surface.get_height()),
                                                x, y, w, h);
 
-            drawing_ctx::render_surface(draw_ctx, &surface, x, y, w, h);
+            drawing_ctx::render_surface(draw_ctx, surface, x, y, w, h);
 
             drawing_ctx::pop_discrete_layer(draw_ctx);
         }
diff --git a/rust/src/marker.rs b/rust/src/marker.rs
index cff75bd..5b8b35e 100644
--- a/rust/src/marker.rs
+++ b/rust/src/marker.rs
@@ -749,7 +749,7 @@ fn emit_markers_for_path_builder<E> (builder: &RsvgPathBuilder,
             Segment::LineOrCurve { .. } => {
                 let (_, incoming_vx, incoming_vy) = find_incoming_directionality_backwards (&segments, 
segments.len () - 1);
 
-                emit_marker (&segment, MarkerEndpoint::End, MarkerType::End, angle_from_vector (incoming_vx, 
incoming_vy), emit_fn);
+                emit_marker (segment, MarkerEndpoint::End, MarkerType::End, angle_from_vector (incoming_vx, 
incoming_vy), emit_fn);
             },
 
             _ => { }
diff --git a/rust/src/shapes.rs b/rust/src/shapes.rs
index 3827702..6371f7c 100644
--- a/rust/src/shapes.rs
+++ b/rust/src/shapes.rs
@@ -136,7 +136,7 @@ impl NodeTrait for NodePoly {
     fn set_atts (&self, _: &RsvgNode, _: *const RsvgHandle, pbag: *const RsvgPropertyBag) -> NodeResult {
         // support for svg < 1.0 which used verts
 
-        for name in vec! ["verts", "points"] {
+        for name in &["verts", "points"] {
             if let Some (value) = property_bag::lookup (pbag, name) {
                 let result = parsers::list_of_points (value.trim ());
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]