Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clippy attrs on extern "Rust" blocks #1062

Merged
merged 2 commits into from Jul 4, 2022
Merged

Clippy attrs on extern "Rust" blocks #1062

merged 2 commits into from Jul 4, 2022

Commits on Jul 4, 2022

  1. Preserve clippy attrs on extern "Rust" fn

        #[cxx::bridge]
        mod ffi {
            extern "Rust" {
                #[allow(clippy::too_many_arguments)]
                fn repro(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) -> bool;
            }
        }
    
    Before:
    
        warning: this function has too many arguments (8/7)
         --> src/main.rs:5:12
          |
        5 |         fn repro(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) -> bool;
          |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          |
          = note: `#[warn(clippy::too_many_arguments)]` on by default
          = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
    
    After: no lint.
    dtolnay committed Jul 4, 2022
    Copy the full SHA
    66ba9a0 View commit details
    Browse the repository at this point in the history
  2. Propagate attrs from extern mod onto all contents

        #[cxx::bridge]
        mod ffi {
            #[allow(clippy::too_many_arguments)]
            extern "Rust" {
                fn repro(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) -> bool;
            }
        }
    
    Before:
    
        warning: this function has too many arguments (8/7)
         --> src/main.rs:5:12
          |
        5 |         fn repro(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) -> bool;
          |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          |
          = note: `#[warn(clippy::too_many_arguments)]` on by default
          = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
    
    After: no lint.
    dtolnay committed Jul 4, 2022
    Copy the full SHA
    30427e0 View commit details
    Browse the repository at this point in the history