spelling and clippy fixes
This commit is contained in:
parent
963a3323ea
commit
351bb0741b
|
@ -1,15 +1,19 @@
|
||||||
{
|
{
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
|
"bitor",
|
||||||
"Creds",
|
"Creds",
|
||||||
"deserialise",
|
"deserialise",
|
||||||
"Elefren",
|
"Elefren",
|
||||||
|
"expecteds",
|
||||||
"favourite",
|
"favourite",
|
||||||
"favourited",
|
"favourited",
|
||||||
"indoc",
|
"indoc",
|
||||||
"isolang",
|
"isolang",
|
||||||
"querystring",
|
"querystring",
|
||||||
"reblog",
|
"reblog",
|
||||||
|
"repr",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
|
"subscope",
|
||||||
"tomlcrate",
|
"tomlcrate",
|
||||||
"tungstenite",
|
"tungstenite",
|
||||||
"Unauth",
|
"Unauth",
|
||||||
|
|
|
@ -193,6 +193,7 @@ mod tests {
|
||||||
website: None,
|
website: None,
|
||||||
};
|
};
|
||||||
let expected = app.clone();
|
let expected = app.clone();
|
||||||
|
#[allow(clippy::useless_conversion)]
|
||||||
let result = app.try_into().expect("Couldn't make App into App");
|
let result = app.try_into().expect("Couldn't make App into App");
|
||||||
assert_eq!(expected, result);
|
assert_eq!(expected, result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,7 @@ use serde::ser::{Serialize, Serializer};
|
||||||
use crate::errors::Error;
|
use crate::errors::Error;
|
||||||
use serde::{
|
use serde::{
|
||||||
de::{self, Visitor},
|
de::{self, Visitor},
|
||||||
Deserialize,
|
Deserialize, Deserializer,
|
||||||
Deserializer,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Represents a set of OAuth scopes
|
/// Represents a set of OAuth scopes
|
||||||
|
@ -41,9 +40,7 @@ impl FromStr for Scopes {
|
||||||
let scope = Scope::from_str(scope)?;
|
let scope = Scope::from_str(scope)?;
|
||||||
set.insert(scope);
|
set.insert(scope);
|
||||||
}
|
}
|
||||||
Ok(Scopes {
|
Ok(Scopes { scopes: set })
|
||||||
scopes: set,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,15 +177,13 @@ impl Scopes {
|
||||||
/// let read_write = read.and(write);
|
/// let read_write = read.and(write);
|
||||||
/// ```
|
/// ```
|
||||||
pub fn and(self, other: Scopes) -> Scopes {
|
pub fn and(self, other: Scopes) -> Scopes {
|
||||||
let newset: HashSet<_> = self
|
let new_set: HashSet<_> = self
|
||||||
.scopes
|
.scopes
|
||||||
.union(&other.scopes)
|
.union(&other.scopes)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.copied()
|
.copied()
|
||||||
.collect();
|
.collect();
|
||||||
Scopes {
|
Scopes { scopes: new_set }
|
||||||
scopes: newset,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _write(subscope: Option<Write>) -> Scopes {
|
fn _write(subscope: Option<Write>) -> Scopes {
|
||||||
|
@ -202,9 +197,7 @@ impl Scopes {
|
||||||
fn new(scope: Scope) -> Scopes {
|
fn new(scope: Scope) -> Scopes {
|
||||||
let mut set = HashSet::new();
|
let mut set = HashSet::new();
|
||||||
set.insert(scope);
|
set.insert(scope);
|
||||||
Scopes {
|
Scopes { scopes: set }
|
||||||
scopes: set,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +297,7 @@ impl FromStr for Scope {
|
||||||
|
|
||||||
impl PartialOrd for Scope {
|
impl PartialOrd for Scope {
|
||||||
fn partial_cmp(&self, other: &Scope) -> Option<Ordering> {
|
fn partial_cmp(&self, other: &Scope) -> Option<Ordering> {
|
||||||
Some(self.cmp(other))
|
Some(self.cmp(other))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,7 +773,8 @@ mod tests {
|
||||||
("push", Scope::Push),
|
("push", Scope::Push),
|
||||||
];
|
];
|
||||||
for (source, expected) in &tests {
|
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);
|
assert_eq!(result, *expected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue