Skip to content

Commit 2e31c96

Browse files
committed
fix: clippy lints
1 parent 6468f1e commit 2e31c96

File tree

4 files changed

+16
-28
lines changed

4 files changed

+16
-28
lines changed

examples/src/bin/auth_azure.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ use xal::{
1616
use xal_examples::auth_main;
1717

1818
// Replace with your own Azure Client parameters
19-
const CLIENT_ID: &'static str = "388ea51c-0b25-4029-aae2-17df49d23905";
20-
const REDIRECT_URL: &'static str = "http://localhost:8080/auth/callback";
19+
const CLIENT_ID: &str = "388ea51c-0b25-4029-aae2-17df49d23905";
20+
const REDIRECT_URL: &str = "http://localhost:8080/auth/callback";
2121
const CLIENT_SECRET: Option<&'static str> = None;
2222

2323
pub struct HttpCallbackHandler {

examples/src/bin/auth_titlehub.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Download savegames for a specific title
22
//!
3-
use std::collections::HashMap;
3+
use std::{collections::HashMap, path::Path};
44
use std::io::Write;
55
use std::path::PathBuf;
66

@@ -52,8 +52,8 @@ pub struct SavegameAtoms {
5252
}
5353

5454
// Replace with your own Azure Client parameters
55-
const CLIENT_ID: &'static str = "388ea51c-0b25-4029-aae2-17df49d23905";
56-
const REDIRECT_URL: &'static str = "http://localhost:8080/auth/callback";
55+
const CLIENT_ID: &str = "388ea51c-0b25-4029-aae2-17df49d23905";
56+
const REDIRECT_URL: &str = "http://localhost:8080/auth/callback";
5757
const CLIENT_SECRET: Option<&'static str> = None;
5858

5959
pub struct HttpCallbackHandler {
@@ -97,7 +97,7 @@ impl AuthPromptCallback for HttpCallbackHandler {
9797
}
9898
}
9999

100-
pub fn assemble_filepath(root_path: &PathBuf, atom_type: &str, path: &str) -> PathBuf {
100+
pub fn assemble_filepath(root_path: &Path, atom_type: &str, path: &str) -> PathBuf {
101101
let modified_path = {
102102
let tmp = path
103103
// Replace separator with platform-specific separator
@@ -107,9 +107,9 @@ pub fn assemble_filepath(root_path: &PathBuf, atom_type: &str, path: &str) -> Pa
107107
.replace("X", ".")
108108
.replace("E", "-");
109109

110-
if tmp.starts_with(std::path::MAIN_SEPARATOR_STR) {
110+
if let Some(stripped) = tmp.strip_prefix(std::path::MAIN_SEPARATOR_STR) {
111111
// Remove leading path seperator
112-
tmp[1..].to_string()
112+
stripped.to_string()
113113
}
114114
else {
115115
tmp
@@ -173,7 +173,7 @@ async fn main() -> Result<(), Error> {
173173
let scid = "05c20100-6e60-45d5-878a-4903149e11ae";
174174

175175
let mut target_dir = PathBuf::new();
176-
target_dir.push(&pfn);
176+
target_dir.push(pfn);
177177
target_dir.push(&xuid);
178178

179179
if !target_dir.exists() {
@@ -248,7 +248,7 @@ async fn main() -> Result<(), Error> {
248248

249249
if let Some(parent) = filepath.parent() {
250250
if !parent.exists() {
251-
std::fs::create_dir_all(&parent)?;
251+
std::fs::create_dir_all(parent)?;
252252
}
253253
}
254254

src/authenticator.rs

+5-15
Original file line numberDiff line numberDiff line change
@@ -943,9 +943,7 @@ impl XalAuthenticator {
943943
.send()
944944
.await?
945945
.json_ex::<response::SisuAuthorizationResponse>()
946-
.await
947-
.map_err(std::convert::Into::into)
948-
}
946+
.await}
949947

950948
/// Requests a Xbox Live Device Token from the Xbox Live authentication service.
951949
///
@@ -1013,9 +1011,7 @@ impl XalAuthenticator {
10131011
.send()
10141012
.await?
10151013
.json_ex::<response::DeviceToken>()
1016-
.await
1017-
.map_err(std::convert::Into::into)
1018-
}
1014+
.await}
10191015

10201016
/// Retrieves a Xbox User Token for a specified Access Token.
10211017
///
@@ -1090,9 +1086,7 @@ impl XalAuthenticator {
10901086
.log()
10911087
.await?
10921088
.json_ex::<response::UserToken>()
1093-
.await
1094-
.map_err(std::convert::Into::into)
1095-
}
1089+
.await}
10961090

10971091
/// Retrieves a Title Token for a specified Access Token and Device Token.
10981092
///
@@ -1170,9 +1164,7 @@ impl XalAuthenticator {
11701164
.log()
11711165
.await?
11721166
.json_ex::<response::TitleToken>()
1173-
.await
1174-
.map_err(std::convert::Into::into)
1175-
}
1167+
.await}
11761168

11771169
/// Authenticates with the Xbox Live service and retrieves an XSTS token.
11781170
///
@@ -1275,9 +1267,7 @@ impl XalAuthenticator {
12751267
.log()
12761268
.await?
12771269
.json_ex::<response::XSTSToken>()
1278-
.await
1279-
.map_err(std::convert::Into::into)
1280-
}
1270+
.await}
12811271
}
12821272

12831273
#[cfg(test)]

src/request_signer.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,7 @@ impl RequestSigner {
365365
&request.authorization,
366366
&request.body,
367367
max_body_bytes,
368-
)
369-
.map_err(std::convert::Into::into)
370-
}
368+
)}
371369

372370
/// Create signature from low-level parts
373371
#[allow(clippy::too_many_arguments)]

0 commit comments

Comments
 (0)