From 983f219a72afb0c5841be9c73ff532bee8b808ec Mon Sep 17 00:00:00 2001 From: Mingun Date: Mon, 4 Sep 2023 01:03:25 +0500 Subject: [PATCH] Merge two if conditions --- src/name.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/name.rs b/src/name.rs index 59498e86..ab4eeaa6 100644 --- a/src/name.rs +++ b/src/name.rs @@ -493,15 +493,11 @@ impl NamespaceResolver { } Some(PrefixDeclaration::Named(prefix)) => { let start = buffer.len(); + let ns = Namespace(&v); - if v == RESERVED_NAMESPACE_XMLNS.1.into_inner() { - // error, non-`xmlns` prefix set to xmlns uri - return Err(Error::ReservedNamespaceError { - prefix: String::from_utf8(prefix.to_vec()).unwrap(), - name: String::from_utf8(v.to_vec()).unwrap(), - }); - } else if v == RESERVED_NAMESPACE_XML.1.into_inner() { + if ns == RESERVED_NAMESPACE_XML.1 || ns == RESERVED_NAMESPACE_XMLNS.1 { // error, non-`xml` prefix set to xml uri + // error, non-`xmlns` prefix set to xmlns uri return Err(Error::ReservedNamespaceError { prefix: String::from_utf8(prefix.to_vec()).unwrap(), name: String::from_utf8(v.to_vec()).unwrap(),