summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorD. Scott Boggs <scott@tams.tech>2022-12-28 09:24:45 -0500
committerD. Scott Boggs <scott@tams.tech>2022-12-29 05:59:43 -0500
commitf3c546f9c07ba4b5fba94f5095a1e5e1809ad572 (patch)
tree1e8762f64b0e64acdebc635420180515e2c0546a
parented5557064613d75683659556a9aefe89493048be (diff)
spelling and clippy fixesfix/spelling
-rw-r--r--.vscode/settings.json4
-rw-r--r--src/apps.rs1
-rw-r--r--src/scopes.rs22
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<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 }
}
}
@@ -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))
}
}
@@ -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);
}
}