diff --git a/examples/register/mod.rs b/examples/register/mod.rs index 72802ae..9c881e5 100644 --- a/examples/register/mod.rs +++ b/examples/register/mod.rs @@ -68,7 +68,7 @@ pub fn bool_input(message: impl AsRef, default: bool) -> Result { or 'n', case insensitive: " ); bool_input(message, default) - }, + } } } else { Ok(default) diff --git a/src/entities/account.rs b/src/entities/account.rs index d66f4ed..bac9b79 100644 --- a/src/entities/account.rs +++ b/src/entities/account.rs @@ -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 Deserialize<'de> + Serialize> ItemsIter { self.buffer = items; self.cur_idx = 0; Some(()) - }, + } Err(err) => { warn!(err = as_debug!(err); "error encountered filling next page"); None - }, + } _ => None, } } diff --git a/src/event_stream.rs b/src/event_stream.rs index 3295d0e..c35ac9a 100644 --- a/src/event_stream.rs +++ b/src/event_stream.rs @@ -73,18 +73,18 @@ fn make_event(lines: &[String]) -> Result { .ok_or_else(|| Error::Other("Missing `data` line for notification".to_string()))?; let notification = serde_json::from_str::(&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::(&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))), }) diff --git a/src/helpers/read_response.rs b/src/helpers/read_response.rs index 0d876dc..66ce2b0 100644 --- a/src/helpers/read_response.rs +++ b/src/helpers/read_response.rs @@ -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 }) } } diff --git a/src/mastodon.rs b/src/mastodon.rs index 68d9b02..aef3bb7 100644 --- a/src/mastodon.rs +++ b/src/mastodon.rs @@ -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()) - }, + } } } } diff --git a/src/registration.rs b/src/registration.rs index 00e4d65..ce09cf2 100644 --- a/src/registration.rs +++ b/src/registration.rs @@ -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()) - }, + } } } } diff --git a/src/requests/push.rs b/src/requests/push.rs index d0a4f5b..4392c08 100644 --- a/src/requests/push.rs +++ b/src/requests/push.rs @@ -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 }, } ); } diff --git a/src/scopes.rs b/src/scopes.rs index 5876aff..4efd8f5 100644 --- a/src/scopes.rs +++ b/src/scopes.rs @@ -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())), }) }