[librsvg: 2/3] Rename `new` to `clone_with_node`
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 2/3] Rename `new` to `clone_with_node`
- Date: Mon, 21 Feb 2022 16:10:49 +0000 (UTC)
commit 622296a02a2cfc771c69eb168b67d39d5fb5575e
Author: Michael Howell <michael notriddle com>
Date: Mon Feb 14 14:58:41 2022 -0700
Rename `new` to `clone_with_node`
Recommended by nightly clippy.
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/663>
src/drawing_ctx.rs | 2 +-
src/node.rs | 4 ++--
src/structure.rs | 9 +++++++--
src/text.rs | 6 +++---
4 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index 7a0d90041..be0788944 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -544,7 +544,7 @@ impl DrawingCtx {
}) {
child.draw(
acquired_nodes,
- &CascadedValues::new(&cascaded, &child),
+ &CascadedValues::clone_with_node(&cascaded, &child),
self,
true,
)?;
diff --git a/src/node.rs b/src/node.rs
index 705b81fd1..5d99ec9a6 100644
--- a/src/node.rs
+++ b/src/node.rs
@@ -116,7 +116,7 @@ impl<'a> CascadedValues<'a> {
/// This is what nodes should normally use to draw their children from their `draw()` method.
/// Nodes that need to override the cascade for their children can use `new_from_values()`
/// instead.
- pub fn new(&self, node: &'a Node) -> CascadedValues<'a> {
+ pub fn clone_with_node(&self, node: &'a Node) -> CascadedValues<'a> {
match self.inner {
CascadedInner::FromNode(_) => CascadedValues {
inner: CascadedInner::FromNode(node.borrow_element()),
@@ -331,7 +331,7 @@ impl NodeDraw for Node {
let child_bbox = draw_ctx.draw_node_from_stack(
&child,
acquired_nodes,
- &CascadedValues::new(cascaded, &child),
+ &CascadedValues::clone_with_node(cascaded, &child),
clipping,
)?;
bbox.insert(&child_bbox);
diff --git a/src/structure.rs b/src/structure.rs
index 3fd90a407..257b04ebd 100644
--- a/src/structure.rs
+++ b/src/structure.rs
@@ -89,7 +89,12 @@ impl Draw for Switch {
let elt = c.borrow_element();
elt.get_cond(dc.user_language()) && !elt.is_in_error()
}) {
- child.draw(an, &CascadedValues::new(cascaded, &child), dc, clipping)
+ child.draw(
+ an,
+ &CascadedValues::clone_with_node(cascaded, &child),
+ dc,
+ clipping,
+ )
} else {
Ok(dc.empty_bbox())
}
@@ -548,7 +553,7 @@ impl Draw for Link {
}
}
- let cascaded = CascadedValues::new(cascaded, node);
+ let cascaded = CascadedValues::clone_with_node(cascaded, node);
let values = cascaded.get();
let elt = node.borrow_element();
diff --git a/src/text.rs b/src/text.rs
index 712c8c6d1..7f897eb42 100644
--- a/src/text.rs
+++ b/src/text.rs
@@ -516,7 +516,7 @@ fn children_to_chunks(
match *child.borrow_element() {
Element::TSpan(ref tspan) => {
- let cascaded = CascadedValues::new(cascaded, &child);
+ let cascaded = CascadedValues::clone_with_node(cascaded, &child);
tspan.to_chunks(
&child,
acquired_nodes,
@@ -540,7 +540,7 @@ fn children_to_chunks(
// The code works because the `tspan` is dropped immediately after calling to_chunks and
no
// references are retained for it.
let tspan = TSpan::default();
- let cascaded = CascadedValues::new(cascaded, &child);
+ let cascaded = CascadedValues::clone_with_node(cascaded, &child);
tspan.to_chunks(
&child,
acquired_nodes,
@@ -555,7 +555,7 @@ fn children_to_chunks(
}
Element::TRef(ref tref) => {
- let cascaded = CascadedValues::new(cascaded, &child);
+ let cascaded = CascadedValues::clone_with_node(cascaded, &child);
tref.to_chunks(&child, acquired_nodes, &cascaded, chunks, depth + 1);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]