Skip to content

Commit 45361e9

Browse files
authored
Merge pull request #958 from tshepang/clippy
cargo clippy --fix
2 parents 7ff4e67 + 8dfd1de commit 45361e9

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

src/check_synced.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ pub(crate) fn check_github(data: &Data) -> Result<(), failure::Error> {
104104
.collect::<Result<HashMap<_, _>, failure::Error>>()?;
105105

106106
for team in data.teams() {
107-
let local_teams = team.github_teams(&data)?;
107+
let local_teams = team.github_teams(data)?;
108108
let local_team = local_teams.into_iter().find(|t| t.org == "rust-lang");
109109
let local_team = match local_team {
110110
Some(t) => t,

src/data.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl Data {
7474
self.load_dir(&path, false, f.clone())?;
7575
} else if !nested && path.is_file() && path.extension() == Some(OsStr::new("toml")) {
7676
fn dir(path: &PathBuf) -> Option<&str> {
77-
Some(path.parent()?.file_name()?.to_str()?)
77+
path.parent()?.file_name()?.to_str()
7878
}
7979
f(self, dir(&path).unwrap(), load_file(&path)?)?;
8080
}
@@ -147,7 +147,7 @@ impl Data {
147147
}
148148

149149
pub(crate) fn repos(&self) -> impl Iterator<Item = &Repo> {
150-
self.repos.iter().map(|(_, repo)| repo)
150+
self.repos.values()
151151
}
152152

153153
pub(crate) fn archived_teams(&self) -> impl Iterator<Item = &Team> {
@@ -157,7 +157,7 @@ impl Data {
157157

158158
fn load_file<T: for<'de> Deserialize<'de>>(path: &Path) -> Result<T, Error> {
159159
let content =
160-
std::fs::read(&path).with_context(|_| format!("failed to read {}", path.display()))?;
160+
std::fs::read(path).with_context(|_| format!("failed to read {}", path.display()))?;
161161
let parsed = toml::from_slice(&content)
162162
.with_context(|_| format!("failed to parse {}", path.display()))?;
163163
Ok(parsed)

src/github.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ impl GitHubApi {
291291
}
292292

293293
fn user_node_id(id: usize) -> String {
294-
base64::encode(&format!("04:User{}", id))
294+
base64::encode(format!("04:User{}", id))
295295
}
296296

297297
#[derive(Debug, serde::Deserialize)]

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ fn run() -> Result<(), Error> {
216216
let name = switch(team.name);
217217
bots.push(name.to_owned());
218218
} else if team.name == "bots" {
219-
bots.extend(BOTS.into_iter().map(|&s| switch(s.to_owned())));
219+
bots.extend(BOTS.iter().map(|&s| switch(s.to_owned())));
220220
} else {
221221
teams.insert(team.name, team.permission.as_toml().to_owned());
222222
}
@@ -251,7 +251,7 @@ fn run() -> Result<(), Error> {
251251
branch: branches,
252252
};
253253
let file = format!("repos/{org}/{name}.toml");
254-
std::fs::write(&file, toml::to_string_pretty(&repo)?.as_bytes())?;
254+
std::fs::write(file, toml::to_string_pretty(&repo)?.as_bytes())?;
255255
}
256256
Cli::StaticApi { ref dest } => {
257257
let dest = PathBuf::from(dest);

src/static_api.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ pub(crate) struct Generator<'a> {
1414
impl<'a> Generator<'a> {
1515
pub(crate) fn new(dest: &'a Path, data: &'a Data) -> Result<Generator<'a>, Error> {
1616
if dest.is_dir() {
17-
std::fs::remove_dir_all(&dest)?;
17+
std::fs::remove_dir_all(dest)?;
1818
}
19-
std::fs::create_dir_all(&dest)?;
19+
std::fs::create_dir_all(dest)?;
2020

2121
Ok(Generator { dest, data })
2222
}
@@ -94,7 +94,7 @@ impl<'a> Generator<'a> {
9494
}
9595
})
9696
.collect(),
97-
branch_protections: branch_protections,
97+
branch_protections,
9898
};
9999

100100
self.add(&format!("v1/repos/{}.json", r.name), &repo)?;

src/validate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ fn validate_github_teams(data: &Data, errors: &mut Vec<String>) {
477477
team.github_teams(data)?.into_iter(),
478478
errors,
479479
|gh_team, _| {
480-
if !allowed.contains(&*gh_team.org) {
480+
if !allowed.contains(gh_team.org) {
481481
bail!(
482482
"GitHub organization `{}` isn't allowed (in team `{}`)",
483483
gh_team.org,

src/zulip.rs

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

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

0 commit comments

Comments
 (0)