From 770dff7cb0f3698cf9492333456d5087961d77c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Sun, 29 Mar 2020 21:25:18 +0200 Subject: [PATCH] minidom: Don't borrow prefix in Prefixes.get MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maxime “pep” Buquet --- minidom-rs/src/element.rs | 2 +- minidom-rs/src/prefixes.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/minidom-rs/src/element.rs b/minidom-rs/src/element.rs index 9041166..fdd4dd1 100644 --- a/minidom-rs/src/element.rs +++ b/minidom-rs/src/element.rs @@ -1093,7 +1093,7 @@ mod tests { assert_eq!(elem.name(), String::from("bar")); assert_eq!(elem.ns(), String::from("ns1")); // Ensure the prefix is properly added to the store - assert_eq!(elem.prefixes.get(Some(String::from("foo"))), Some(&String::from("ns1"))); + assert_eq!(elem.prefixes.get(&Some(String::from("foo"))), Some(&String::from("ns1"))); } #[test] diff --git a/minidom-rs/src/prefixes.rs b/minidom-rs/src/prefixes.rs index e6bb0d5..0406e2b 100644 --- a/minidom-rs/src/prefixes.rs +++ b/minidom-rs/src/prefixes.rs @@ -49,8 +49,8 @@ impl Prefixes { &self.prefixes } - pub fn get(&self, prefix: Prefix) -> Option<&Namespace> { - self.prefixes.get(&prefix) + pub fn get(&self, prefix: &Prefix) -> Option<&Namespace> { + self.prefixes.get(prefix) } pub(crate) fn insert>(&mut self, prefix: Prefix, namespace: S) {