diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2022-11-06 20:52:54 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2022-11-06 20:52:54 -0800 |
commit | 3320e8fa5d120b8bc4917152114cf78cb0e504dc (patch) | |
tree | 0249e18d462740b174a6ce5c5a0322f63a6d5c8f /adenosine-cli/src/lib.rs | |
parent | 2641389cb74939df9090a8183ec67ab0558f0b06 (diff) | |
download | adenosine-3320e8fa5d120b8bc4917152114cf78cb0e504dc.tar.gz adenosine-3320e8fa5d120b8bc4917152114cf78cb0e504dc.zip |
cli: partial clippy cleanups
Diffstat (limited to 'adenosine-cli/src/lib.rs')
-rw-r--r-- | adenosine-cli/src/lib.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/adenosine-cli/src/lib.rs b/adenosine-cli/src/lib.rs index 8dbfa6c..f05a865 100644 --- a/adenosine-cli/src/lib.rs +++ b/adenosine-cli/src/lib.rs @@ -58,7 +58,7 @@ impl XrpcClient { nsid: &str, params: Option<HashMap<String, String>>, ) -> Result<Option<Value>> { - let params: HashMap<String, String> = params.unwrap_or(HashMap::new()); + let params: HashMap<String, String> = params.unwrap_or_default(); let res = self .http_client .get(format!("{}/xrpc/{}", self.host, nsid)) @@ -88,7 +88,7 @@ impl XrpcClient { params: Option<HashMap<String, String>>, output: &mut W, ) -> Result<u64> { - let params: HashMap<String, String> = params.unwrap_or(HashMap::new()); + let params: HashMap<String, String> = params.unwrap_or_default(); let res = self .http_client .get(format!("{}/xrpc/{}", self.host, nsid)) @@ -117,7 +117,7 @@ impl XrpcClient { params: Option<HashMap<String, String>>, body: Option<Value>, ) -> Result<Option<Value>> { - let params: HashMap<String, String> = params.unwrap_or(HashMap::new()); + let params: HashMap<String, String> = params.unwrap_or_default(); let mut req = self .http_client .post(format!("{}/xrpc/{}", self.host, nsid)) @@ -155,7 +155,7 @@ impl XrpcClient { params: Option<HashMap<String, String>>, input: &mut R, ) -> Result<Option<Value>> { - let params: HashMap<String, String> = params.unwrap_or(HashMap::new()); + let params: HashMap<String, String> = params.unwrap_or_default(); let mut buf: Vec<u8> = Vec::new(); input.read_to_end(&mut buf)?; let res = self @@ -181,7 +181,7 @@ impl XrpcClient { /// Tries to parse a DID internal identifier from a JWT (as base64-encoded token) pub fn parse_did_from_jwt(jwt: &str) -> Result<String> { - let second_b64 = jwt.split(".").nth(1).ok_or(anyhow!("couldn't parse JWT"))?; + let second_b64 = jwt.split('.').nth(1).ok_or(anyhow!("couldn't parse JWT"))?; let second_json: Vec<u8> = base64::decode_config(second_b64, base64::URL_SAFE)?; let obj: Value = serde_json::from_slice(&second_json)?; // trying to also support pulling "aud" as DID; not sure this is actually correct use of |