Giter Site home page Giter Site logo

Comments (6)

la10736 avatar la10736 commented on June 26, 2024 1

Wired!!!!
On my side it works like a charm in all cases

damico@miklap:~/dev_random/rstest_226$ cargo test && cat src/main.rs && cargo clippy && rustup show | tail
    Finished test [unoptimized + debuginfo] target(s) in 0.01s
     Running unittests src/main.rs (target/debug/deps/rstest_226-a0447c32f017b59d)

running 1 test
test tests::test_fn::case_1 ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

fn main() {
    println!("Hello, world!");
}

mod tests {
    use rstest::rstest;

    #[allow(clippy::too_many_arguments)] // this does not work
    #[rstest]
    #[allow(clippy::too_many_arguments)] // this does not work
    #[case(1, 2, 3, 4, 5, 6, 7, 8)]
    #[allow(clippy::too_many_arguments)] // this does not work
    fn test_fn(
        #[case] _a: u8,
        #[case] _b: u8,
        #[case] _c: u8,
        #[case] _d: u8,
        #[case] _e: u8,
        #[case] _f: u8,
        #[case] _g: u8,
        #[case] _h: u8,
    ) {
    }
}
    Checking rstest_226 v0.1.0 (/home/mdamico/dev_random/rstest_226)
    Finished dev [unoptimized + debuginfo] target(s) in 0.05s
active toolchain
----------------

stable-x86_64-unknown-linux-gnu (default)
rustc 1.74.1 (a28077b28 2023-12-04)

from rstest.

la10736 avatar la10736 commented on June 26, 2024

from rstest.

dariocurr avatar dariocurr commented on June 26, 2024

Put it at module level solved the issue. By the way I provide you the example:

#[allow(clippy::too_many_arguments)] // this works
mod tests {
    use rstest::rstest;

    #[allow(clippy::too_many_arguments)] // this does not work
    #[rstest]
    #[case(1, 2, 3, 4, 5, 6, 7, 8)]
    fn test_fn(
        #[case] _a: u8,
        #[case] _b: u8,
        #[case] _c: u8,
        #[case] _d: u8,
        #[case] _e: u8,
        #[case] _f: u8,
        #[case] _g: u8,
        #[case] _h: u8,
    ) {
    }
}

from rstest.

la10736 avatar la10736 commented on June 26, 2024

Ok... According to https://docs.rs/rstest/latest/rstest/attr.rstest.html#use-specific-case-attributes you should move the annotation before the function instead of put it before #[rstest].

from rstest.

dariocurr avatar dariocurr commented on June 26, 2024

Sorry, I should have mentioned before that I tried it already. As you can check:

//#[allow(clippy::too_many_arguments)] // this works
mod tests {
    use rstest::rstest;

    #[allow(clippy::too_many_arguments)] // this does not work
    #[rstest]
    #[allow(clippy::too_many_arguments)] // this does not work
    #[case(1, 2, 3, 4, 5, 6, 7, 8)]
    #[allow(clippy::too_many_arguments)] // this does not work
    fn test_fn(
        #[case] _a: u8,
        #[case] _b: u8,
        #[case] _c: u8,
        #[case] _d: u8,
        #[case] _e: u8,
        #[case] _f: u8,
        #[case] _g: u8,
        #[case] _h: u8,
    ) {
    }
}

from rstest.

dariocurr avatar dariocurr commented on June 26, 2024

Then I guess it's a rust-analyzer bug

image

Moreover, If i run cargo clippy -- --deny warnings, everything works fine

from rstest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.