Skip to content

Commit 3174290

Browse files
authored
Inline format args (#270)
1 parent 30ced32 commit 3174290

15 files changed

+30
-40
lines changed

examples/github.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ fn main() {
115115
// Exchange the code with a token.
116116
let token_res = client.exchange_code(code).request(&http_client);
117117

118-
println!("Github returned the following token:\n{:?}\n", token_res);
118+
println!("Github returned the following token:\n{token_res:?}\n");
119119

120120
if let Ok(token) = token_res {
121121
// NB: Github returns a single comma-separated "scope" parameter instead of multiple
@@ -130,6 +130,6 @@ fn main() {
130130
} else {
131131
Vec::new()
132132
};
133-
println!("Github returned the following scopes:\n{:?}\n", scopes);
133+
println!("Github returned the following scopes:\n{scopes:?}\n");
134134
}
135135
}

examples/github_async.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ async fn main() {
116116
// Exchange the code with a token.
117117
let token_res = client.exchange_code(code).request_async(&http_client).await;
118118

119-
println!("Github returned the following token:\n{:?}\n", token_res);
119+
println!("Github returned the following token:\n{token_res:?}\n");
120120

121121
if let Ok(token) = token_res {
122122
// NB: Github returns a single comma-separated "scope" parameter instead of multiple
@@ -131,6 +131,6 @@ async fn main() {
131131
} else {
132132
Vec::new()
133133
};
134-
println!("Github returned the following scopes:\n{:?}\n", scopes);
134+
println!("Github returned the following scopes:\n{scopes:?}\n");
135135
}
136136
}

examples/google.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,7 @@ fn main() {
132132
.set_pkce_verifier(pkce_code_verifier)
133133
.request(&http_client);
134134

135-
println!(
136-
"Google returned the following token:\n{:?}\n",
137-
token_response
138-
);
135+
println!("Google returned the following token:\n{token_response:?}\n");
139136

140137
// Revoke the obtained token
141138
let token_response = token_response.unwrap();

examples/google_devicecode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,5 @@ fn main() {
8383
.request(&http_client, std::thread::sleep, None)
8484
.expect("Failed to get token");
8585

86-
println!("Google returned the following token:\n{:?}\n", token);
86+
println!("Google returned the following token:\n{token:?}\n");
8787
}

examples/letterboxd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ fn main() -> Result<(), anyhow::Error> {
6565
.exchange_password(&letterboxd_username, &letterboxd_password)
6666
.request(&|request| http_client.execute(request))?;
6767

68-
println!("{:?}", token_result);
68+
println!("{token_result:?}");
6969

7070
Ok(())
7171
}

examples/microsoft_devicecode_common_user.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
4141
.request_async(&http_client, tokio::time::sleep, None)
4242
.await;
4343

44-
eprintln!("Token:{:?}", token_result);
44+
eprintln!("Token:{token_result:?}");
4545

4646
Ok(())
4747
}

examples/microsoft_devicecode_tenant_user.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
4848
.request_async(&http_client, tokio::time::sleep, None)
4949
.await;
5050

51-
eprintln!("Token:{:?}", token_result);
51+
eprintln!("Token:{token_result:?}");
5252

5353
Ok(())
5454
}

examples/msgraph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,5 +138,5 @@ fn main() {
138138
.set_pkce_verifier(pkce_code_verifier)
139139
.request(&http_client);
140140

141-
println!("MS Graph returned the following token:\n{:?}\n", token);
141+
println!("MS Graph returned the following token:\n{token:?}\n");
142142
}

examples/wunderlist.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,5 @@ fn main() {
222222
.add_extra_param("client_secret", client_secret_str)
223223
.request(&http_client);
224224

225-
println!(
226-
"Wunderlist returned the following token:\n{:?}\n",
227-
token_res
228-
);
225+
println!("Wunderlist returned the following token:\n{token_res:?}\n");
229226
}

src/devicecode.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,7 @@ where
455455
let timeout_dur = timeout.unwrap_or_else(|| self.dev_auth_resp.expires_in());
456456
let chrono_timeout = chrono::Duration::from_std(timeout_dur).map_err(|e| {
457457
RequestTokenError::Other(format!(
458-
"failed to convert `{:?}` to `chrono::Duration`: {}",
459-
timeout_dur, e
458+
"failed to convert `{timeout_dur:?}` to `chrono::Duration`: {e}"
460459
))
461460
})?;
462461

@@ -694,10 +693,9 @@ mod tests {
694693
\"verification_uri\": \"https://verify/here\", \
695694
\"user_code\": \"abcde\", \
696695
\"verification_uri_complete\": \"https://verify/here?abcde\", \
697-
\"expires_in\": {}, \
696+
\"expires_in\": {expires_in}, \
698697
\"interval\": 1 \
699-
}}",
700-
expires_in
698+
}}"
701699
);
702700

703701
let device_auth_url =

0 commit comments

Comments
 (0)