Run cargo-fmt on whole codebase

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2022-12-27 16:03:25 +01:00 committed by Scott Boggs
parent d61c2e5c91
commit c689b8390c
9 changed files with 16 additions and 22 deletions

View File

@ -68,7 +68,7 @@ pub fn bool_input(message: impl AsRef<str>, default: bool) -> Result<bool> {
or 'n', case insensitive: "
);
bool_input(message, default)
},
}
}
} else {
Ok(default)

View File

@ -4,8 +4,7 @@ use crate::status_builder;
use chrono::prelude::*;
use serde::{
de::{self, Deserializer, Unexpected},
Deserialize,
Serialize,
Deserialize, Serialize,
};
use std::path::PathBuf;
@ -104,7 +103,7 @@ fn string_or_bool<'de, D: Deserializer<'de>>(val: D) -> ::std::result::Result<bo
&"true or false",
));
}
},
}
})
}

View File

@ -59,11 +59,11 @@ impl<'a, T: Clone + for<'de> Deserialize<'de> + Serialize> ItemsIter<T> {
self.buffer = items;
self.cur_idx = 0;
Some(())
},
}
Err(err) => {
warn!(err = as_debug!(err); "error encountered filling next page");
None
},
}
_ => None,
}
}

View File

@ -73,18 +73,18 @@ fn make_event(lines: &[String]) -> Result<Event> {
.ok_or_else(|| Error::Other("Missing `data` line for notification".to_string()))?;
let notification = serde_json::from_str::<Notification>(&data)?;
Event::Notification(notification)
},
}
"update" => {
let data =
data.ok_or_else(|| Error::Other("Missing `data` line for update".to_string()))?;
let status = serde_json::from_str::<Status>(&data)?;
Event::Update(status)
},
}
"delete" => {
let data =
data.ok_or_else(|| Error::Other("Missing `data` line for delete".to_string()))?;
Event::Delete(data)
},
}
"filters_changed" => Event::FiltersChanged,
_ => return Err(Error::Other(format!("Unknown event `{}`", event))),
})

View File

@ -66,9 +66,6 @@ where
// we've received an error message, let's deserialize that instead.
let response = serde_json::from_slice(bytes)?;
debug!(status = as_debug!(status), response = as_serde!(response); "error received from API");
Err(Error::Api {
status,
response,
})
Err(Error::Api { status, response })
}
}

View File

@ -348,11 +348,11 @@ impl Mastodon {
file.read_to_end(&mut data)?;
// TODO extract filename, error on dirs, etc.
Ok(Part::bytes(data).file_name(Cow::Owned(path.to_string_lossy().to_string())))
},
}
Err(err) => {
error!(path = as_debug!(path), error = as_debug!(err); "error reading file contents for multipart form");
Err(err.into())
},
}
}
}
}

View File

@ -197,7 +197,7 @@ impl<'a> Registration<'a> {
"received API response"
);
Ok(response)
},
}
Err(err) => {
error!(
err = as_debug!(err), url = url, method = stringify!($method),
@ -205,7 +205,7 @@ impl<'a> Registration<'a> {
"error making API request"
);
Err(err.into())
},
}
}
}
}

View File

@ -574,9 +574,7 @@ mod tests {
form,
update_data::Form {
id: "some-id".to_string(),
data: update_data::Data {
alerts: None,
},
data: update_data::Data { alerts: None },
}
);
}

View File

@ -285,11 +285,11 @@ impl FromStr for Scope {
read if read.starts_with("read:") => {
let r: Read = Read::from_str(&read[5..])?;
Scope::Read(Some(r))
},
}
write if write.starts_with("write:") => {
let w: Write = Write::from_str(&write[6..])?;
Scope::Write(Some(w))
},
}
_ => return Err(Error::Other("Unknown scope".to_string())),
})
}