Skip to content

Commit

Permalink
spelling and clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dscottboggs committed Dec 29, 2022
1 parent 963a332 commit 351bb07
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{
"cSpell.words": [
"bitor",
"Creds",
"deserialise",
"Elefren",
"expecteds",
"favourite",
"favourited",
"indoc",
"isolang",
"querystring",
"reblog",
"repr",
"reqwest",
"subscope",
"tomlcrate",
"tungstenite",
"Unauth",
Expand Down
1 change: 1 addition & 0 deletions src/apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
22 changes: 8 additions & 14 deletions src/scopes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 })
}
}

Expand Down Expand Up @@ -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 {
Expand All @@ -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 }
}
}

Expand Down Expand Up @@ -304,7 +297,7 @@ impl FromStr for Scope {

impl PartialOrd for Scope {
fn partial_cmp(&self, other: &Scope) -> Option<Ordering> {
Some(self.cmp(other))
Some(self.cmp(other))
}
}

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

0 comments on commit 351bb07

Please # to comment.