Skip to content

Commit 72fd029

Browse files
committed
cargo fmt
1 parent 9192ef3 commit 72fd029

File tree

2 files changed

+31
-24
lines changed

2 files changed

+31
-24
lines changed

src/handle_caldav.rs

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ impl<C: Clone + Send + Sync + 'static> DavInner<C> {
9090
namespace,
9191
}) => {
9292
let mut elem = Element::new(&name.local_name);
93-
if let Some(prefix) = name.prefix
94-
&& let Some(uri) = namespace.get(&prefix) {
95-
elem.namespace = Some(uri.to_string());
93+
if let Some(prefix) = name.prefix
94+
&& let Some(uri) = namespace.get(&prefix)
95+
{
96+
elem.namespace = Some(uri.to_string());
9697
}
9798

9899
for attr in attributes {
@@ -160,9 +161,9 @@ impl<C: Clone + Send + Sync + 'static> DavInner<C> {
160161
// Parse comp-filter elements
161162
for filter_child in &elem.children {
162163
if let XMLNode::Element(filter_elem) = filter_child
163-
&& filter_elem.name == "comp-filter" {
164-
query.comp_filter =
165-
Some(self.parse_component_filter(filter_elem)?);
164+
&& filter_elem.name == "comp-filter"
165+
{
166+
query.comp_filter = Some(self.parse_component_filter(filter_elem)?);
166167
}
167168
}
168169
}
@@ -300,7 +301,8 @@ impl<C: Clone + Send + Sync + 'static> DavInner<C> {
300301

301302
for child in &root.children {
302303
if let XMLNode::Element(elem) = child
303-
&& elem.name == "href" {
304+
&& elem.name == "href"
305+
{
304306
for href_child in &elem.children {
305307
if let XMLNode::Text(href) = href_child {
306308
hrefs.push(href.clone());
@@ -316,8 +318,9 @@ impl<C: Clone + Send + Sync + 'static> DavInner<C> {
316318
fn parse_freebusy_query(&self, root: &Element) -> DavResult<TimeRange> {
317319
for child in &root.children {
318320
if let XMLNode::Element(elem) = child
319-
&& elem.name == "time-range" {
320-
return self.parse_time_range(elem);
321+
&& elem.name == "time-range"
322+
{
323+
return self.parse_time_range(elem);
321324
}
322325
}
323326

@@ -354,12 +357,13 @@ impl<C: Clone + Send + Sync + 'static> DavInner<C> {
354357
let metadata = file.metadata().await?;
355358

356359
if let Ok(data) = file.read_bytes(metadata.len() as usize).await
357-
&& is_calendar_data(&data) {
358-
let content = String::from_utf8_lossy(&data);
360+
&& is_calendar_data(&data)
361+
{
362+
let content = String::from_utf8_lossy(&data);
359363

360-
if self.matches_query(&content, &query) {
361-
results.push((item_path.clone(), content.to_string()));
362-
}
364+
if self.matches_query(&content, &query) {
365+
results.push((item_path.clone(), content.to_string()));
366+
}
363367
}
364368
}
365369
}
@@ -386,13 +390,14 @@ impl<C: Clone + Send + Sync + 'static> DavInner<C> {
386390
.open(&item_path, OpenOptions::read(), &self.credentials)
387391
.await
388392
{
389-
let metadata = file.metadata().await?;
393+
let metadata = file.metadata().await?;
390394

391-
if let Ok(data) = &file.read_bytes(metadata.len() as usize).await
392-
&& is_calendar_data(data) {
393-
let content = String::from_utf8_lossy(data);
394-
results.push((item_path, content.to_string()));
395-
}
395+
if let Ok(data) = &file.read_bytes(metadata.len() as usize).await
396+
&& is_calendar_data(data)
397+
{
398+
let content = String::from_utf8_lossy(data);
399+
results.push((item_path, content.to_string()));
400+
}
396401
}
397402
}
398403

@@ -434,8 +439,9 @@ impl<C: Clone + Send + Sync + 'static> DavInner<C> {
434439
// and apply all the filters properly
435440

436441
if let Some(ref comp_filter) = query.comp_filter
437-
&& !content.contains(&format!("BEGIN:{}", comp_filter.name)) {
438-
false
442+
&& !content.contains(&format!("BEGIN:{}", comp_filter.name))
443+
{
444+
false
439445
} else {
440446
true
441447
}

src/handle_props.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,9 @@ impl<C: Clone + Send + Sync + 'static> PropWriter<C> {
911911
self.fs.get_props(path, docontent, &self.credentials).await
912912
{
913913
for prop_item in props {
914-
if prop_item.name.contains("calendar-description")
915-
&& let Some(value) = prop_item.xml {
914+
if prop_item.name.contains("calendar-description")
915+
&& let Some(value) = prop_item.xml
916+
{
916917
let desc = String::from_utf8_lossy(&value);
917918
return self.build_elem(docontent, pfx, prop, desc);
918919
}

0 commit comments

Comments
 (0)