Skip to content

Commit

Permalink
Ignore ref_as_ptr clippy pedantic lint in generated code
Browse files Browse the repository at this point in the history
    warning: reference as raw pointer
      --> tests/ffi/module.rs:34:31
       |
    34 |         fn c_take_trivial_ref(d: &D);
       |                               ^^^^^ help: try: `std::ptr::from_ref::<D>(d)`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr
       = note: `-W clippy::ref-as-ptr` implied by `-W clippy::pedantic`
       = help: to override `-W clippy::pedantic` add `#[allow(clippy::ref_as_ptr)]`

    warning: reference as raw pointer
      --> tests/ffi/module.rs:35:35
       |
    35 |         fn c_take_trivial_mut_ref(d: &mut D);
       |                                   ^^^^^^^^^ help: try: `std::ptr::from_mut::<D>(d)`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr

    warning: reference as raw pointer
      --> tests/ffi/module.rs:36:35
       |
    36 |         fn c_take_trivial_pin_ref(d: Pin<&D>);
       |                                   ^^^^^^^^^ help: try: `std::ptr::from_ref::<D>(d)`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr

    warning: reference as raw pointer
      --> tests/ffi/module.rs:37:39
       |
    37 |         fn c_take_trivial_pin_mut_ref(d: Pin<&mut D>);
       |                                       ^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<D>(d)`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr

    warning: reference as raw pointer
      --> tests/ffi/module.rs:42:34
       |
    42 |         fn c_take_trivial_ns_ref(g: &G);
       |                                  ^^^^^ help: try: `std::ptr::from_ref::<G>(g)`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr

    warning: reference as raw pointer
      --> tests/ffi/module.rs:45:30
       |
    45 |         fn c_take_opaque_ref(e: &E);
       |                              ^^^^^ help: try: `std::ptr::from_ref::<E>(e)`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr

    warning: reference as raw pointer
      --> tests/ffi/module.rs:49:33
       |
    49 |         fn c_take_opaque_ns_ref(e: &F);
       |                                 ^^^^^ help: try: `std::ptr::from_ref::<F>(e)`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr

    warning: reference as raw pointer
      --> tests/ffi/module.rs:55:36
       |
    55 |         fn c_return_opaque_mut_pin(e: Pin<&mut E>) -> Pin<&mut E>;
       |                                    ^^^^^^^^^^^^^ help: try: `std::ptr::from_mut::<E>(e)`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr

    warning: reference as raw pointer
       --> tests/ffi/lib.rs:138:25
        |
    138 |         fn c_take_ref_r(r: &R);
        |                         ^^^^^ help: try: `std::ptr::from_ref::<R>(r)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr

    warning: reference as raw pointer
       --> tests/ffi/lib.rs:167:37
        |
    167 |         fn c_take_ref_shared_string(s: &SharedString) -> &SharedString;
        |                                     ^^^^^^^^^^^^^^^^ help: try: `std::ptr::from_ref::<SharedString>(s)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr

    warning: reference as raw pointer
       --> tests/ffi/lib.rs:342:34
        |
    342 |     impl CxxVector<SharedString> {}
        |                                  ^^ help: try: `std::ptr::from_mut::<{}>({})`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr

    warning: reference as raw pointer
       --> tests/ffi/lib.rs:116:77
        |
    116 |         fn c_return_unique_ptr_vector_shared() -> UniquePtr<CxxVector<Shared>>;
        |                                                                             ^ help: try: `std::ptr::from_mut::<>>(>)`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_as_ptr
  • Loading branch information
dtolnay committed Feb 10, 2024
1 parent 131fbc4 commit 375d159
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions macro/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ fn expand(ffi: Module, doc: Doc, attrs: OtherAttrs, apis: &[Api], types: &Types)
clippy::items_after_statements,
clippy::no_effect_underscore_binding,
clippy::ptr_as_ptr,
clippy::ref_as_ptr,
clippy::upper_case_acronyms,
clippy::use_self,
)]
Expand Down

0 comments on commit 375d159

Please sign in to comment.