[librsvg: 8/17] Inline function in its only caller




commit 72a5138804110fd9ce9f03bf8de321f7ab898750
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Aug 29 15:30:25 2022 -0500

    Inline function in its only caller
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/738>

 src/document.rs | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)
---
diff --git a/src/document.rs b/src/document.rs
index bc9ded7db..e1060088a 100644
--- a/src/document.rs
+++ b/src/document.rs
@@ -614,20 +614,16 @@ impl DocumentBuilder {
     /// Creates a node for an XML text element as a child of `parent`.
     pub fn append_characters(&mut self, text: &str, parent: &mut Node) {
         if !text.is_empty() {
-            self.append_chars_to_parent(text, parent);
+            // When the last child is a Chars node we can coalesce
+            // the text and avoid screwing up the Pango layouts
+            if let Some(child) = parent.last_child().filter(|c| c.is_chars()) {
+                child.borrow_chars().append(text);
+            } else {
+                parent.append(Node::new(NodeData::new_chars(text)));
+            };
         }
     }
 
-    fn append_chars_to_parent(&mut self, text: &str, parent: &mut Node) {
-        // When the last child is a Chars node we can coalesce
-        // the text and avoid screwing up the Pango layouts
-        if let Some(child) = parent.last_child().filter(|c| c.is_chars()) {
-            child.borrow_chars().append(text);
-        } else {
-            parent.append(Node::new(NodeData::new_chars(text)));
-        };
-    }
-
     pub fn resolve_href(&self, href: &str) -> Result<AllowedUrl, AllowedUrlError> {
         self.load_options.url_resolver.resolve_href(href)
     }


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