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

Improvement of strange lint warnings #1162

Closed
Enyium opened this issue Jan 25, 2023 · 1 comment · Fixed by #1172
Closed

Improvement of strange lint warnings #1162

Enyium opened this issue Jan 25, 2023 · 1 comment · Fixed by #1172

Comments

@Enyium
Copy link
Contributor

Enyium commented Jan 25, 2023

I have #![warn(clippy::pedantic)] in my crate's lib.rs. In CXX bridges, this can lead to warnings about things that are not my business. If you could please use #[allow(clippy::pedantic)] in the relevant, not all-encompassing locations, this would solve these warnings. If you aren't sure where exactly, here's concrete warnings I get:


Not related to #![warn(clippy::pedantic)] is the following kind of warning: Without #![allow(dead_code)] in my bridge, I get associated constant `FOO_BAR` is never used on enums. Is there a better allowable warning possible, something with "unused"? The worst is, I can't use #[allow(dead_code)] on the whole enum, but only on every single currently unused variant, which are many in that large enum. (Hence, I'm temporarily using it on the whole bridge, which works again.)


Related: #1061

@edward-shen
Copy link

The clippy::use_self lint also seems to be emitted when defining a shared enum type that has an existing c++ enum implementation:

Repro:

Rust side

#[cxx::bridge]
mod ffi {
    #[derive(Debug)]
    enum SomeErrorType {
        EMPTY,
    }

    unsafe extern "C++" {
        include!("mylibrary.h");
        type SomeErrorType;
    }
}

Cpp side

enum class SomeErrorType : unsigned char {
  EMPTY,
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants