[librsvg] cargo-clippy: Pass references to RsvgBbox, don't move the values
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] cargo-clippy: Pass references to RsvgBbox, don't move the values
- Date: Thu, 22 Feb 2018 19:54:57 +0000 (UTC)
commit 7c6c55ce5cb5d116f2b214cc6ae71fc1b2fd529d
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Feb 22 13:20:08 2018 -0600
cargo-clippy: Pass references to RsvgBbox, don't move the values
rust/src/bbox.rs | 1 +
rust/src/gradient.rs | 6 +++---
rust/src/paint_server.rs | 4 ++--
rust/src/pattern.rs | 6 +++---
4 files changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/rust/src/bbox.rs b/rust/src/bbox.rs
index 907ac108..6fa5d4e9 100644
--- a/rust/src/bbox.rs
+++ b/rust/src/bbox.rs
@@ -7,6 +7,7 @@ use util::*;
/* Keep this in sync with ../../rsvg-private.h:RsvgBbox */
#[repr(C)]
+#[derive(Copy, Clone)]
pub struct RsvgBbox {
pub rect: cairo::Rectangle,
pub affine: cairo::Matrix,
diff --git a/rust/src/gradient.rs b/rust/src/gradient.rs
index 89856ac5..acaf1066 100644
--- a/rust/src/gradient.rs
+++ b/rust/src/gradient.rs
@@ -684,7 +684,7 @@ pub extern fn rsvg_node_radial_gradient_new (_: *const libc::c_char, raw_parent:
fn resolve_fallbacks_and_set_pattern (gradient: &Gradient,
draw_ctx: *mut RsvgDrawingCtx,
opacity: u8,
- bbox: RsvgBbox) -> bool {
+ bbox: &RsvgBbox) -> bool {
let mut fallback_source = NodeFallbackSource::new (draw_ctx);
if bbox.is_empty() {
@@ -699,14 +699,14 @@ fn resolve_fallbacks_and_set_pattern (gradient: &Gradient,
pub fn gradient_resolve_fallbacks_and_set_pattern (node: &RsvgNode,
draw_ctx: *mut RsvgDrawingCtx,
opacity: u8,
- bbox: RsvgBbox) -> bool {
+ bbox: &RsvgBbox) -> bool {
assert! (node.get_type () == NodeType::LinearGradient || node.get_type () == NodeType::RadialGradient);
let mut did_set_gradient = false;
node.with_impl (|node_gradient: &NodeGradient| {
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);
+ did_set_gradient = resolve_fallbacks_and_set_pattern (&gradient, draw_ctx, opacity, &bbox);
});
did_set_gradient
diff --git a/rust/src/paint_server.rs b/rust/src/paint_server.rs
index 2c2f2441..aa35b00a 100644
--- a/rust/src/paint_server.rs
+++ b/rust/src/paint_server.rs
@@ -233,10 +233,10 @@ pub extern "C" fn _set_source_rsvg_paint_server(
node,
c_ctx,
opacity,
- c_bbox,
+ &c_bbox,
);
} else if node.get_type() == NodeType::Pattern {
- had_paint_server = pattern::pattern_resolve_fallbacks_and_set_pattern(node, c_ctx,
c_bbox);
+ had_paint_server = pattern::pattern_resolve_fallbacks_and_set_pattern(node, c_ctx,
&c_bbox);
}
}
diff --git a/rust/src/pattern.rs b/rust/src/pattern.rs
index dbe800bc..57621010 100644
--- a/rust/src/pattern.rs
+++ b/rust/src/pattern.rs
@@ -464,12 +464,12 @@ fn set_pattern_on_draw_context (pattern: &Pattern,
fn resolve_fallbacks_and_set_pattern (pattern: &Pattern,
draw_ctx: *mut RsvgDrawingCtx,
- bbox: RsvgBbox) -> bool {
+ bbox: &RsvgBbox) -> bool {
let mut fallback_source = NodeFallbackSource::new (draw_ctx);
let resolved = resolve_pattern (pattern, &mut fallback_source);
- set_pattern_on_draw_context (&resolved, draw_ctx, &bbox)
+ set_pattern_on_draw_context (&resolved, draw_ctx, bbox)
}
#[no_mangle]
@@ -481,7 +481,7 @@ pub extern fn rsvg_node_pattern_new (_: *const libc::c_char, raw_parent: *const
pub fn pattern_resolve_fallbacks_and_set_pattern (node: &RsvgNode,
draw_ctx: *mut RsvgDrawingCtx,
- bbox: RsvgBbox) -> bool {
+ bbox: &RsvgBbox) -> bool {
assert! (node.get_type () == NodeType::Pattern);
let mut did_set_pattern = false;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]