spelling and clippy fixes

This commit is contained in:
D. Scott Boggs 2022-12-28 09:24:45 -05:00 committed by Scott Boggs
parent 963a3323ea
commit 351bb0741b
3 changed files with 13 additions and 14 deletions

View File

@ -1,15 +1,19 @@
{
"cSpell.words": [
"bitor",
"Creds",
"deserialise",
"Elefren",
"expecteds",
"favourite",
"favourited",
"indoc",
"isolang",
"querystring",
"reblog",
"repr",
"reqwest",
"subscope",
"tomlcrate",
"tungstenite",
"Unauth",

View File

@ -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);
}

View File

@ -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<Write>) -> 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 }
}
}
@ -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);
}
}