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:
@@ -11,7 +11,7 @@ pub use self::details::{TimingToken, PassTimes, take_current, add_to_current};
|
||||
//
|
||||
// This macro defines:
|
||||
//
|
||||
// - A C-style enum containing all the pass names and a `NoPass` variant.
|
||||
// - A C-style enum containing all the pass names and a `None` variant.
|
||||
// - A usize constant with the number of defined passes.
|
||||
// - A const array of pass descriptions.
|
||||
// - A public function per pass used to start the timing of that pass.
|
||||
@@ -21,9 +21,9 @@ macro_rules! define_passes {
|
||||
} => {
|
||||
#[allow(non_camel_case_types)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
enum $enum { $($pass,)+ NoPass }
|
||||
enum $enum { $($pass,)+ None}
|
||||
|
||||
const $num_passes: usize = $enum::NoPass as usize;
|
||||
const $num_passes: usize = $enum::None as usize;
|
||||
|
||||
const $descriptions: [&str; $num_passes] = [ $($desc),+ ];
|
||||
|
||||
@@ -164,7 +164,7 @@ mod details {
|
||||
|
||||
/// Information about passes in a single thread.
|
||||
thread_local!{
|
||||
static CURRENT_PASS: Cell<Pass> = Cell::new(Pass::NoPass);
|
||||
static CURRENT_PASS: Cell<Pass> = Cell::new(Pass::None);
|
||||
static PASS_TIME: RefCell<PassTimes> = RefCell::new(Default::default());
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ mod details {
|
||||
}
|
||||
|
||||
/// Add `timings` to the accumulated timings for the current thread.
|
||||
pub fn add_to_current(times: PassTimes) {
|
||||
pub fn add_to_current(times: &PassTimes) {
|
||||
PASS_TIME.with(|rc| for (a, b) in rc.borrow_mut().pass.iter_mut().zip(
|
||||
×.pass,
|
||||
)
|
||||
@@ -221,7 +221,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn display() {
|
||||
assert_eq!(Pass::NoPass.to_string(), "<no pass>");
|
||||
assert_eq!(Pass::None.to_string(), "<no pass>");
|
||||
assert_eq!(Pass::regalloc.to_string(), "Register allocation");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user