From 351bb0741b1f84a9554301a0aa76f1343b9f39cb Mon Sep 17 00:00:00 2001 From: "D. Scott Boggs" Date: Wed, 28 Dec 2022 09:24:45 -0500 Subject: [PATCH] spelling and clippy fixes --- .vscode/settings.json | 4 ++++ src/apps.rs | 1 + src/scopes.rs | 22 ++++++++-------------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 2c859eb..16ca026 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,15 +1,19 @@ { "cSpell.words": [ + "bitor", "Creds", "deserialise", "Elefren", + "expecteds", "favourite", "favourited", "indoc", "isolang", "querystring", "reblog", + "repr", "reqwest", + "subscope", "tomlcrate", "tungstenite", "Unauth", diff --git a/src/apps.rs b/src/apps.rs index 5b05cae..86674fe 100644 --- a/src/apps.rs +++ b/src/apps.rs @@ -193,6 +193,7 @@ mod tests { website: None, }; let expected = app.clone(); + #[allow(clippy::useless_conversion)] let result = app.try_into().expect("Couldn't make App into App"); assert_eq!(expected, result); } diff --git a/src/scopes.rs b/src/scopes.rs index 35c9a80..5876aff 100644 --- a/src/scopes.rs +++ b/src/scopes.rs @@ -11,8 +11,7 @@ use serde::ser::{Serialize, Serializer}; use crate::errors::Error; use serde::{ de::{self, Visitor}, - Deserialize, - Deserializer, + Deserialize, Deserializer, }; /// Represents a set of OAuth scopes @@ -41,9 +40,7 @@ impl FromStr for Scopes { let scope = Scope::from_str(scope)?; set.insert(scope); } - Ok(Scopes { - scopes: set, - }) + Ok(Scopes { scopes: set }) } } @@ -180,15 +177,13 @@ impl Scopes { /// let read_write = read.and(write); /// ``` pub fn and(self, other: Scopes) -> Scopes { - let newset: HashSet<_> = self + let new_set: HashSet<_> = self .scopes .union(&other.scopes) .into_iter() .copied() .collect(); - Scopes { - scopes: newset, - } + Scopes { scopes: new_set } } fn _write(subscope: Option) -> Scopes { @@ -202,9 +197,7 @@ impl Scopes { fn new(scope: Scope) -> Scopes { let mut set = HashSet::new(); set.insert(scope); - Scopes { - scopes: set, - } + Scopes { scopes: set } } } @@ -304,7 +297,7 @@ impl FromStr for Scope { impl PartialOrd for Scope { fn partial_cmp(&self, other: &Scope) -> Option { - Some(self.cmp(other)) + Some(self.cmp(other)) } } @@ -780,7 +773,8 @@ mod tests { ("push", Scope::Push), ]; for (source, expected) in &tests { - let result = Scope::from_str(source).expect(&format!("Couldn't parse '{}'", &source)); + let result = + Scope::from_str(source).unwrap_or_else(|_| panic!("Couldn't parse '{}'", &source)); assert_eq!(result, *expected); } }