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

Warnings caused by plex macros #45

Open
kaimast opened this issue Apr 20, 2020 · 4 comments
Open

Warnings caused by plex macros #45

kaimast opened this issue Apr 20, 2020 · 4 comments

Comments

@kaimast
Copy link
Contributor

kaimast commented Apr 20, 2020

I started seeing these on the newest rust nightly

kai@kai-thinkpad ~/d/plex (master)> cargo test
   Compiling proc-macro2 v1.0.10
   Compiling unicode-xid v0.2.0
   Compiling bit-vec v0.4.4
   Compiling syn v1.0.17
   Compiling vec_map v0.6.0
   Compiling lalr v0.0.2
   Compiling bit-set v0.4.0
   Compiling redfa v0.0.2
   Compiling quote v1.0.3
   Compiling plex v0.2.5 (/home/kai/dev/plex)
warning: unnecessary braces around block return value
   --> examples/demo.rs:167:13
    |
167 |             Ident(var) Equals assign[rhs] => Expr {
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these braces
    |
    = note: `#[warn(unused_braces)]` on by default

warning: unnecessary braces around block return value
   --> examples/demo.rs:200:13
    |
200 |             Ident(i) => Expr {
    |             ^^^^^^^^ help: remove these braces

warning: unnecessary braces around block return value
   --> examples/demo.rs:204:13
    |
204 |             Integer(i) => Expr {
    |             ^^^^^^^^^^ help: remove these braces

    Finished test [unoptimized + debuginfo] target(s) in 22.71s
     Running target/debug/deps/plex-1283d3a11f2149ad

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

   Doc-tests plex

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Adding #![allow(unused_braces)] to src/lib.rs fixes it when compiling plex itself but not when using the macro in other projects (or the tests above).

@kaimast
Copy link
Contributor Author

kaimast commented Apr 20, 2020

Additionally there's a bunch of clippy warnings that get triggered by plex: clippy::redundant_closure_call clippy::unused_unit clippy::match_single_binding clippy::let_unit_value clippy::unit_arg

@kaimast
Copy link
Contributor Author

kaimast commented Jun 28, 2020

It seems like most recent Rust nightly introduced a linter for unused braces as well. So plex now generates a bunch of errors during normal compilation also.

I will try to look into this sometime this week.

@maxrdz
Copy link

maxrdz commented Sep 28, 2023

I don't have this issue with rustc, but I do with clippy code linting. Defining your production rules causes clippy to show a bunch of warnings, but I just use an attribute to ignore them

@maxrdz
Copy link

maxrdz commented Mar 5, 2024

For anyone who needs it, here are the following linting warnings I suppress.

#![allow(
    clippy::type_complexity,
    clippy::redundant_field_names,
    clippy::ptr_arg,
    clippy::redundant_closure_call,
    clippy::enum_variant_names,
    clippy::let_unit_value
)]

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

No branches or pull requests

2 participants