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

Fix clippy warnings in the generated code #77

Open
fpoli opened this issue May 24, 2023 · 0 comments
Open

Fix clippy warnings in the generated code #77

fpoli opened this issue May 24, 2023 · 0 comments
Labels
good first issue Good for newcomers

Comments

@fpoli
Copy link
Contributor

fpoli commented May 24, 2023

The java_package! prucedural macro currently generates code on which clippy reports some warnings. For example:

$ cargo clippy --manifest-path=test-crates/Cargo.toml

warning: redundant field names in struct initialization
  --> viper/src/lib.rs:78:5
   |
78 |     class CarbonVerifier {
   |     ^^^^^ help: replace it with: `a0`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
   = note: `#[warn(clippy::redundant_field_names)]` on by default

warning: redundant field names in struct initialization
  --> viper/src/lib.rs:78:5
   |
78 |     class CarbonVerifier {
   |     ^^^^^ help: replace it with: `a1`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

warning: redundant field names in struct initialization
  --> viper/src/lib.rs:46:5
   |
46 |     class Program {
   |     ^^^^^ help: replace it with: `a0`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

(...)

warning: this function has too many arguments (9/7)
  --> viper/src/lib.rs:46:5
   |
46 |     class Program {
   |     ^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
   = note: `#[warn(clippy::too_many_arguments)]` on by default

warning: `viper` (lib) generated 12 warnings

In general, it would be nice to fix or suppress these, so that users of the macro don't get warnings for Rust code which they didn't write.

The last clippy::too_many_arguments warning, in particular, correctly signals that a Java method has too many arguments. However, reporting it in the Rust crate that uses the method is incorrect. It should be responsibility of a Java linter (if one is used) to report the warning on the Java codebase.

@fpoli fpoli added the good first issue Good for newcomers label May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant