Skip to content

Commit 6e86262

Browse files
committed
Auto merge of #568 - Mark-Simulacrum:silence-clippy, r=Mark-Simulacrum
Silence clippy lint
2 parents 29fcb56 + 8234003 commit 6e86262

File tree

6 files changed

+37
-34
lines changed

6 files changed

+37
-34
lines changed

src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
#![recursion_limit = "256"]
22
#![allow(
33
clippy::needless_pass_by_value,
4+
clippy::wrong_self_convention,
45
clippy::new_ret_no_self,
56
clippy::too_many_arguments,
6-
clippy::redundant_closure
7+
clippy::redundant_closure,
8+
clippy::unnecessary_wraps,
9+
clippy::needless_question_mark,
10+
clippy::vec_init_then_push,
11+
clippy::upper_case_acronyms
712
)]
813

914
pub mod actions;

src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![allow(clippy::redundant_closure)]
2+
#![allow(clippy::needless_question_mark)]
23

34
use log::info;
45
mod cli;

src/report/markdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ fn render_markdown(context: &ResultsContext) -> Fallible<String> {
132132
&mut rendered,
133133
"* [{}]({}) (not covered in crater testing)",
134134
krate,
135-
crate_to_url(&krate)?
135+
crate_to_url(&krate)
136136
)?;
137137
for krate in deps {
138138
write_crate(&mut rendered, krate, *comparison, true)?;

src/report/mod.rs

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ pub fn generate_report<DB: ReadResults>(
250250
);
251251

252252
Ok(CrateResult {
253-
name: crate_to_name(&krate)?,
254-
url: crate_to_url(&krate)?,
253+
name: crate_to_name(&krate),
254+
url: crate_to_url(&krate),
255255
status: get_crate_version_status(&index, &krate)
256256
.unwrap_or(Some(CrateVersionStatus::MissingFromIndex)),
257257
krate: krate.clone(),
@@ -384,8 +384,8 @@ fn gen_retry_list(res: &RawTestResults) -> String {
384384
out
385385
}
386386

387-
fn crate_to_name(c: &Crate) -> Fallible<String> {
388-
Ok(match *c {
387+
fn crate_to_name(c: &Crate) -> String {
388+
match *c {
389389
Crate::Registry(ref details) => format!("{}-{}", details.name, details.version),
390390
Crate::GitHub(ref repo) => {
391391
if let Some(ref sha) = repo.sha {
@@ -407,11 +407,11 @@ fn crate_to_name(c: &Crate) -> Fallible<String> {
407407
utf8_percent_encode(&repo.url, &REPORT_ENCODE_SET).to_string()
408408
}
409409
}
410-
})
410+
}
411411
}
412412

413-
fn crate_to_url(c: &Crate) -> Fallible<String> {
414-
Ok(match *c {
413+
fn crate_to_url(c: &Crate) -> String {
414+
match *c {
415415
Crate::Registry(ref details) => format!(
416416
"https://crates.io/crates/{}/{}",
417417
details.name, details.version
@@ -430,7 +430,7 @@ fn crate_to_url(c: &Crate) -> Fallible<String> {
430430
),
431431
Crate::Path(ref path) => utf8_percent_encode(path, &REPORT_ENCODE_SET).to_string(),
432432
Crate::Git(ref repo) => repo.url.clone(),
433-
})
433+
}
434434
}
435435

436436
fn compare(
@@ -672,7 +672,7 @@ mod tests {
672672
name: "lazy_static".into(),
673673
version: "1.0".into(),
674674
});
675-
assert_eq!(crate_to_name(&reg).unwrap(), "lazy_static-1.0".to_string());
675+
assert_eq!(crate_to_name(&reg), "lazy_static-1.0".to_string());
676676

677677
let repo = GitHubRepo {
678678
org: "brson".into(),
@@ -681,7 +681,7 @@ mod tests {
681681
};
682682
let gh = Crate::GitHub(repo);
683683

684-
assert_eq!(crate_to_name(&gh).unwrap(), "brson.hello-rs".to_string());
684+
assert_eq!(crate_to_name(&gh), "brson.hello-rs".to_string());
685685

686686
let repo = GitHubRepo {
687687
org: "brson".into(),
@@ -690,10 +690,7 @@ mod tests {
690690
};
691691
let gh = Crate::GitHub(repo);
692692

693-
assert_eq!(
694-
crate_to_name(&gh).unwrap(),
695-
"brson.hello-rs.f00".to_string()
696-
);
693+
assert_eq!(crate_to_name(&gh), "brson.hello-rs.f00".to_string());
697694
}
698695

699696
#[test]
@@ -736,8 +733,8 @@ mod tests {
736733
version: "1.0".into(),
737734
});
738735
assert_eq!(
739-
crate_to_url(&reg).unwrap(),
740-
"https://crates.io/crates/lazy_static/1.0".to_string()
736+
crate_to_url(&reg),
737+
"https://crates.io/crates/lazy_static/1.0"
741738
);
742739

743740
let repo = GitHubRepo {
@@ -747,10 +744,7 @@ mod tests {
747744
};
748745
let gh = Crate::GitHub(repo);
749746

750-
assert_eq!(
751-
crate_to_url(&gh).unwrap(),
752-
"https://github.com/brson/hello-rs".to_string()
753-
);
747+
assert_eq!(crate_to_url(&gh), "https://github.com/brson/hello-rs");
754748

755749
let repo = GitHubRepo {
756750
org: "brson".into(),
@@ -759,8 +753,8 @@ mod tests {
759753
};
760754
let gh = Crate::GitHub(repo);
761755
assert_eq!(
762-
crate_to_url(&gh).unwrap(),
763-
"https://github.com/brson/hello-rs/tree/f00".to_string()
756+
crate_to_url(&gh),
757+
"https://github.com/brson/hello-rs/tree/f00"
764758
);
765759
}
766760

src/runner/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,14 @@ pub fn run_ex<DB: WriteResults + Sync>(
110110
.spawn(move || worker.run())?;
111111
threads.push(join);
112112
}
113-
let disk_watcher_thread = scope
114-
.builder()
115-
.name("disk-space-watcher".into())
116-
.spawn(|| disk_watcher.run())?;
113+
let disk_watcher_thread =
114+
scope
115+
.builder()
116+
.name("disk-space-watcher".into())
117+
.spawn(|| {
118+
disk_watcher.run();
119+
Ok(())
120+
})?;
117121

118122
let clean_exit = join_threads(threads.drain(..));
119123
disk_watcher.stop();

src/runner/worker.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,24 +171,24 @@ impl<'a, DB: WriteResults + Sync> DiskSpaceWatcher<'a, DB> {
171171
self.stop_send.lock().unwrap().send(()).unwrap();
172172
}
173173

174-
pub(super) fn run(&self) -> Fallible<()> {
174+
pub(super) fn run(&self) {
175175
loop {
176-
self.check()?;
176+
self.check();
177177
match self.stop_recv.lock().unwrap().recv_timeout(self.interval) {
178-
Ok(()) => return Ok(()),
178+
Ok(()) => return,
179179
Err(RecvTimeoutError::Timeout) => {}
180180
Err(RecvTimeoutError::Disconnected) => panic!("disconnected stop channel"),
181181
}
182182
}
183183
}
184184

185-
fn check(&self) -> Fallible<()> {
185+
fn check(&self) {
186186
let usage = match crate::utils::disk_usage::DiskUsage::fetch() {
187187
Ok(usage) => usage,
188188
Err(err) => {
189189
// TODO: `current_mount` fails sometimes on Windows with ERROR_DEVICE_NOT_READY.
190190
warn!("Failed to check space remaining: {}", err);
191-
return Ok(());
191+
return;
192192
}
193193
};
194194

@@ -198,6 +198,5 @@ impl<'a, DB: WriteResults + Sync> DiskSpaceWatcher<'a, DB> {
198198
worker.schedule_target_dir_cleanup();
199199
}
200200
}
201-
Ok(())
202201
}
203202
}

0 commit comments

Comments
 (0)