Skip to content

Commit d90a5f8

Browse files
committed
cargo clippy --fix
1 parent 5e74b7d commit d90a5f8

File tree

8 files changed

+28
-28
lines changed

8 files changed

+28
-28
lines changed

src/api/github.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl GitHubApi {
5858
let url = if url.starts_with("https://") {
5959
Cow::Borrowed(url)
6060
} else {
61-
Cow::Owned(format!("{}{}", API_BASE, url))
61+
Cow::Owned(format!("{API_BASE}{url}"))
6262
};
6363
if require_auth {
6464
self.require_auth()?;
@@ -68,7 +68,7 @@ impl GitHubApi {
6868
if let Some(token) = &self.token {
6969
req = req.header(
7070
header::AUTHORIZATION,
71-
HeaderValue::from_str(&format!("token {}", token))?,
71+
HeaderValue::from_str(&format!("token {token}"))?,
7272
);
7373
}
7474
Ok(req)
@@ -108,7 +108,7 @@ impl GitHubApi {
108108

109109
pub(crate) fn user(&self, login: &str) -> Result<User, Error> {
110110
Ok(self
111-
.prepare(false, Method::GET, &format!("users/{}", login))?
111+
.prepare(false, Method::GET, &format!("users/{login}"))?
112112
.send()?
113113
.error_for_status()?
114114
.json()?)

src/api/zulip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl ZulipApi {
7777
) -> Result<Response, Error> {
7878
let mut req = self
7979
.client
80-
.request(method, format!("{}{}", ZULIP_BASE_URL, path));
80+
.request(method, format!("{ZULIP_BASE_URL}{path}"));
8181

8282
if let Some((username, token)) = &self.auth {
8383
req = req.basic_auth(username, Some(token))

src/ci.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ fn generate_codeowners_content(data: Data) -> String {
9191
})
9292
.flat_map(|(team, _)| {
9393
data.team(team)
94-
.expect(&format!("team {team} not found"))
94+
.unwrap_or_else(|| panic!("team {team} not found"))
9595
.members(&data)
96-
.expect(&format!("team {team} members couldn't be loaded"))
96+
.unwrap_or_else(|_| panic!("team {team} members couldn't be loaded"))
9797
}),
9898
);
9999

src/data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl Data {
9595
{
9696
for entry in std::fs::read_dir(&dir).with_context(|| {
9797
let dir = dir.as_ref().display();
98-
format!("`load_dir` failed to read directory '{}'", dir)
98+
format!("`load_dir` failed to read directory '{dir}'")
9999
})? {
100100
let path = entry?.path();
101101
if nested && path.is_dir() {

src/main.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ impl FromStr for DataSource {
165165
let path = PathBuf::from(path);
166166
if path.is_dir() {
167167
Ok(Self::Prebuilt {
168-
path: PathBuf::from(path),
168+
path: path,
169169
})
170170
} else {
171171
Err(
@@ -201,7 +201,7 @@ fn main() {
201201
env.init();
202202

203203
if let Err(e) = run() {
204-
error!("{:?}", e);
204+
error!("{e:?}");
205205
std::process::exit(1);
206206
}
207207
}
@@ -257,7 +257,7 @@ fn run() -> Result<(), Error> {
257257
bail!("person already in the repo: {}", github_name);
258258
}
259259

260-
let file = format!("people/{}.toml", github_name);
260+
let file = format!("people/{github_name}.toml");
261261
std::fs::write(
262262
&file,
263263
toml::to_string_pretty(&PersonToAdd {
@@ -278,7 +278,7 @@ fn run() -> Result<(), Error> {
278278
.as_bytes(),
279279
)?;
280280

281-
info!("written data to {}", file);
281+
info!("written data to {file}");
282282
}
283283
Cli::StaticApi { ref dest } => {
284284
let dest = PathBuf::from(dest);
@@ -312,7 +312,7 @@ fn run() -> Result<(), Error> {
312312
}
313313
}
314314
if let Email::Present(email) = person.email() {
315-
println!("email: {}", email);
315+
println!("email: {email}");
316316
}
317317
println!();
318318

@@ -352,7 +352,7 @@ fn run() -> Result<(), Error> {
352352
println!(" (none)");
353353
} else {
354354
for (repo, perms) in bors_permissions {
355-
println!(" - {}", repo);
355+
println!(" - {repo}");
356356
if perms.review() {
357357
println!(" - review");
358358
}
@@ -373,7 +373,7 @@ fn run() -> Result<(), Error> {
373373
println!(" (none)");
374374
} else {
375375
for key in other_permissions {
376-
println!(" - {}", key);
376+
println!(" - {key}");
377377
}
378378
}
379379
}
@@ -399,7 +399,7 @@ fn run() -> Result<(), Error> {
399399
}
400400
println!("{} ({}):", team.name(), team.kind());
401401
if let Some(parent) = team.subteam_of() {
402-
println!(" parent team: {}", parent);
402+
println!(" parent team: {parent}");
403403
}
404404

405405
println!(" members: ");
@@ -418,7 +418,7 @@ fn run() -> Result<(), Error> {
418418
let mut emails = list.emails().iter().collect::<Vec<_>>();
419419
emails.sort();
420420
for email in emails {
421-
println!("{}", email);
421+
println!("{email}");
422422
}
423423
}
424424
Cli::DumpWebsite => {
@@ -456,7 +456,7 @@ fn run() -> Result<(), Error> {
456456
.collect::<Vec<_>>();
457457
allowed.sort_unstable();
458458
for github_username in &allowed {
459-
println!("{}", github_username);
459+
println!("{github_username}");
460460
}
461461
}
462462
Cli::DumpIndividualAccess { group_by } => {
@@ -526,9 +526,9 @@ fn run() -> Result<(), Error> {
526526
Cli::Sync(opts) => {
527527
if let Err(err) = perform_sync(opts, data) {
528528
// Display shows just the first element of the chain.
529-
error!("failed: {}", err);
529+
error!("failed: {err}");
530530
for cause in err.chain().skip(1) {
531-
error!("caused by: {}", cause);
531+
error!("caused by: {cause}");
532532
}
533533
std::process::exit(1);
534534
}

src/permissions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ impl Permissions {
4747
result.push(boolean.to_string());
4848
}
4949
for repo in config.permissions_bors_repos() {
50-
result.push(format!("bors.{}.review", repo));
51-
result.push(format!("bors.{}.try", repo));
50+
result.push(format!("bors.{repo}.review"));
51+
result.push(format!("bors.{repo}.try"));
5252
}
5353

5454
result

src/static_api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ impl<'a> Generator<'a> {
485485
where
486486
T: serde::Serialize + serde::de::DeserializeOwned + PartialEq,
487487
{
488-
info!("writing API object {}...", path);
488+
info!("writing API object {path}...");
489489
let json = serde_json::to_string_pretty(obj)?;
490490
self.write(path, json.as_bytes())?;
491491

src/validate.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub(crate) fn validate(data: &Data, strict: bool, skip: &[&str]) -> Result<(), E
8989
return Err(err);
9090
} else {
9191
warn!("couldn't perform checks relying on the GitHub API, some errors will not be detected");
92-
warn!("cause: {}", err);
92+
warn!("cause: {err}");
9393
}
9494
} else {
9595
for check in GITHUB_CHECKS {
@@ -105,7 +105,7 @@ pub(crate) fn validate(data: &Data, strict: bool, skip: &[&str]) -> Result<(), E
105105
let zulip = ZulipApi::new();
106106
if let Err(err) = zulip.require_auth() {
107107
warn!("couldn't perform checks relying on the Zulip API, some errors will not be detected");
108-
warn!("cause: {}", err);
108+
warn!("cause: {err}");
109109
} else {
110110
for check in ZULIP_CHECKS {
111111
if skip.contains(&check.name) {
@@ -122,7 +122,7 @@ pub(crate) fn validate(data: &Data, strict: bool, skip: &[&str]) -> Result<(), E
122122
errors.dedup_by(|a, b| a == b);
123123

124124
for err in &errors {
125-
error!("validation error: {}", err);
125+
error!("validation error: {err}");
126126
}
127127

128128
bail!("{} validation errors found", errors.len());
@@ -603,7 +603,7 @@ fn validate_github_usernames(data: &Data, github: &GitHubApi, errors: &mut Vec<S
603603
}
604604
Ok(())
605605
}),
606-
Err(err) => errors.push(format!("couldn't verify GitHub usernames: {}", err)),
606+
Err(err) => errors.push(format!("couldn't verify GitHub usernames: {err}")),
607607
}
608608
}
609609

@@ -682,14 +682,14 @@ fn validate_zulip_users(data: &Data, zulip: &ZulipApi, errors: &mut Vec<String>)
682682
let by_id = match zulip.get_users(false) {
683683
Ok(u) => u.iter().map(|u| u.user_id).collect::<HashSet<_>>(),
684684
Err(err) => {
685-
errors.push(format!("couldn't verify Zulip users: {}", err));
685+
errors.push(format!("couldn't verify Zulip users: {err}"));
686686
return;
687687
}
688688
};
689689
let zulip_groups = match data.zulip_groups() {
690690
Ok(zgs) => zgs,
691691
Err(err) => {
692-
errors.push(format!("couldn't get all the Zulip groups: {}", err));
692+
errors.push(format!("couldn't get all the Zulip groups: {err}"));
693693
return;
694694
}
695695
};

0 commit comments

Comments
 (0)