Lots of clippy appeasement

This commit is contained in:
Lennart
2025-10-27 20:12:21 +01:00
parent 0d071d3b92
commit 86cf490fa9
84 changed files with 413 additions and 435 deletions

View File

@@ -8,7 +8,8 @@ pub struct HrefElement {
}
impl HrefElement {
#[must_use] pub const fn new(href: String) -> Self {
#[must_use]
pub const fn new(href: String) -> Self {
Self { href }
}
}

View File

@@ -19,6 +19,7 @@ pub struct PropstatElement<PropType: XmlSerialize> {
pub status: StatusCode,
}
#[allow(clippy::trivially_copy_pass_by_ref)]
fn xml_serialize_status(
status: &StatusCode,
ns: Option<Namespace>,
@@ -56,6 +57,7 @@ pub struct ResponseElement<PropstatType: XmlSerialize> {
pub propstat: Vec<PropstatWrapper<PropstatType>>,
}
#[allow(clippy::trivially_copy_pass_by_ref, clippy::ref_option)]
fn xml_serialize_optional_status(
val: &Option<StatusCode>,
ns: Option<Namespace>,

View File

@@ -6,7 +6,7 @@ use rustical_xml::XmlDeserialize;
use rustical_xml::XmlError;
use rustical_xml::XmlRootTag;
#[derive(Debug, Clone, XmlDeserialize, XmlRootTag, PartialEq)]
#[derive(Debug, Clone, XmlDeserialize, XmlRootTag, PartialEq, Eq)]
#[xml(root = "propfind", ns = "crate::namespace::NS_DAV")]
pub struct PropfindElement<PN: XmlDeserialize> {
#[xml(ty = "untagged")]

View File

@@ -10,7 +10,8 @@ pub struct SupportedReportSet<T: XmlSerialize + 'static> {
}
impl<T: XmlSerialize + Clone + 'static> SupportedReportSet<T> {
#[must_use] pub fn new(methods: Vec<T>) -> Self {
#[must_use]
pub fn new(methods: Vec<T>) -> Self {
Self {
supported_report: methods
.into_iter()

View File

@@ -40,6 +40,6 @@ mod tests {
<calendar-color xmlns="http://calendarserver.org/ns/"/>
</resourcetype>
</document>"#
)
);
}
}

View File

@@ -56,7 +56,7 @@ impl From<LimitElement> for u64 {
#[derive(XmlDeserialize, Clone, Debug, PartialEq, Eq)]
pub struct NresultsElement(#[xml(ty = "text")] u64);
#[derive(XmlDeserialize, Clone, Debug, PartialEq, XmlRootTag)]
#[derive(XmlDeserialize, Clone, Debug, PartialEq, Eq, XmlRootTag)]
// <!ELEMENT sync-collection (sync-token, sync-level, limit?, prop)>
// <!-- DAV:limit defined in RFC 5323, Section 5.17 -->
// <!-- DAV:prop defined in RFC 4918, Section 14.18 -->
@@ -106,11 +106,11 @@ mod tests {
assert_eq!(
request,
SyncCollectionRequest {
sync_token: "".to_owned(),
sync_token: String::new(),
sync_level: SyncLevel::One,
prop: PropfindType::Prop(PropElement(vec![TestPropName::Getetag], vec![])),
limit: Some(100.into())
}
)
);
}
}

View File

@@ -17,15 +17,13 @@ impl XmlSerialize for TagList {
namespaces: &HashMap<Namespace, &str>,
writer: &mut quick_xml::Writer<&mut Vec<u8>>,
) -> std::io::Result<()> {
let prefix = ns
.and_then(|ns| namespaces.get(&ns))
.map(|prefix| {
if prefix.is_empty() {
String::new()
} else {
format!("{prefix}:")
}
});
let prefix = ns.and_then(|ns| namespaces.get(&ns)).map(|prefix| {
if prefix.is_empty() {
String::new()
} else {
format!("{prefix}:")
}
});
let has_prefix = prefix.is_some();
let tagname = tag.map(|tag| [&prefix.unwrap_or_default(), tag].concat());