Use clippy (#276)
* cton-util: fix some clippy unnecessary pass-by-value warnings * clippy: ignore too many arguments / cyclomatic complexity in module since these functions are taking args coming from the command line, i dont think this is actually a valid lint, morally the arguments are all from one structure * cton-util: take care of remaining clippy warnings * cton-reader: fix all non-suspicious clippy warnings * cton-reader: disable clippy at site of suspicious lint * cton-frontend: disable clippy at the site of an invalid lint * cton-frontend: fix clippy warnings, or ignore benign ones * clippy: ignore the camelcase word WebAssembly in docs * cton-wasm: fix clippy complaints or ignore benign ones * cton-wasm tests: fix clippy complaints * cretonne: starting point turns off all clippy warnings * cretonne: clippy fixes, or lower allow() to source of problem * cretonne: more clippy fixes * cretonne: fix or disable needless_lifetimes lint this linter is buggy when the declared lifetime is used for another type constraint. * cretonne: fix clippy complaint about Pass::NoPass * rustfmt * fix prev minor api changes clippy suggested * add clippy to test-all * cton-filetests: clippy fixes * simplify clippy reporting in test-all * cretonne: document clippy allows better * cretonne: fix some more clippy lints * cretonne: fix clippy lints (mostly doc comments) * cretonne: allow all needless_lifetimes clippy warnings remove overrides at the false positives * rustfmt
This commit is contained in:
@@ -70,7 +70,7 @@ impl ConcurrentRunner {
|
||||
assert!(self.request_tx.is_none(), "must shutdown before join");
|
||||
for h in self.handles.drain(..) {
|
||||
match h.join() {
|
||||
Ok(t) => timing::add_to_current(t),
|
||||
Ok(t) => timing::add_to_current(&t),
|
||||
Err(e) => println!("worker panicked: {:?}", e),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
//! This crate contains the main test driver as well as implementations of the
|
||||
//! available filetest commands.
|
||||
|
||||
#![cfg_attr(feature="cargo-clippy", allow(
|
||||
type_complexity,
|
||||
// Rustfmt 0.9.0 is at odds with this lint:
|
||||
block_in_if_condition_stmt))]
|
||||
|
||||
#[macro_use(dbg)]
|
||||
extern crate cretonne;
|
||||
extern crate cton_reader;
|
||||
@@ -44,7 +49,7 @@ type TestResult = Result<time::Duration, String>;
|
||||
/// Directories are scanned recursively for test cases ending in `.cton`. These test cases are
|
||||
/// executed on background threads.
|
||||
///
|
||||
pub fn run(verbose: bool, files: Vec<String>) -> TestResult {
|
||||
pub fn run(verbose: bool, files: &[String]) -> TestResult {
|
||||
let mut runner = TestRunner::new(verbose);
|
||||
|
||||
for path in files.iter().map(Path::new) {
|
||||
|
||||
@@ -45,7 +45,7 @@ impl Display for QueueEntry {
|
||||
f,
|
||||
"{}.{:03} {}",
|
||||
dur.as_secs(),
|
||||
dur.subsec_nanos() / 1000000,
|
||||
dur.subsec_nanos() / 1_000_000,
|
||||
p
|
||||
)
|
||||
}
|
||||
@@ -135,7 +135,7 @@ impl TestRunner {
|
||||
// This lets us skip spurious extensionless files without statting everything
|
||||
// needlessly.
|
||||
if !dir.is_file() {
|
||||
self.path_error(dir, err);
|
||||
self.path_error(&dir, &err);
|
||||
}
|
||||
}
|
||||
Ok(entries) => {
|
||||
@@ -149,7 +149,7 @@ impl TestRunner {
|
||||
// libstd/sys/unix/fs.rs seems to suggest that breaking now would
|
||||
// be a good idea, or the iterator could keep returning the same
|
||||
// error forever.
|
||||
self.path_error(dir, err);
|
||||
self.path_error(&dir, &err);
|
||||
break;
|
||||
}
|
||||
Ok(entry) => {
|
||||
@@ -172,7 +172,7 @@ impl TestRunner {
|
||||
}
|
||||
|
||||
/// Report an error related to a path.
|
||||
fn path_error<E: Error>(&mut self, path: PathBuf, err: E) {
|
||||
fn path_error<E: Error>(&mut self, path: &PathBuf, err: &E) {
|
||||
self.errors += 1;
|
||||
println!("{}: {}", path.to_string_lossy(), err);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ fn run_one_test<'a>(
|
||||
if !context.verified && test.needs_verifier() {
|
||||
verify_function(&func, context.flags_or_isa()).map_err(
|
||||
|e| {
|
||||
pretty_verifier_error(&func, isa, e)
|
||||
pretty_verifier_error(&func, isa, &e)
|
||||
},
|
||||
)?;
|
||||
context.verified = true;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! SubTest trait.
|
||||
//! `SubTest` trait.
|
||||
|
||||
use std::result;
|
||||
use std::borrow::Cow;
|
||||
|
||||
Reference in New Issue
Block a user