Rocket icon indicating copy to clipboard operation
Rocket copied to clipboard

basic clippy warnings get triggered by macros

Open toxeus opened this issue 3 years ago • 1 comments

Description

  1. rocket::post() proc macro triggers clippy::unused-unit
  2. rocket::routes! triggers clippy::no-effect-underscore-binding

To Reproduce

Enable corresponding lints and run clippy.

Expected Behavior

No clippy warnings for basic clippy warnings.

Environment:

  • OS Distribution and Kernel: Linux
  • Rocket Version: 0.5rc2

toxeus avatar May 30 '22 15:05 toxeus

We don't consider these bugs, but if we can improve codegen to prevent these lints from triggering, then great! Please feel free to send a PR.

I would suggest running cargo expand to determine which part of the generated code is causing the lint to fire and then looking at/grepping the codegen crate to find/modify the generation site.

SergioBenitez avatar May 30 '22 18:05 SergioBenitez

We don't consider these bugs

Agreed, it's technically not a bug. But it's terrible macro hygiene. Your generated code shouldn't trigger lints in my crates.

toxeus avatar Sep 01 '22 21:09 toxeus

We don't consider these bugs

Agreed, it's technically not a bug. But it's terrible macro hygiene. Your generated code shouldn't trigger lints in my crates.

This doesn't have anything to do with macro hygiene. What's more, this isn't rocket triggering warnings in your code, this is an external tool, clippy, that you're running yourself, triggering a warning, often erroneously. Finally, I'm confused by the seeming condescension (my apologies if I'm reading your message incorrectly). I have no opposition to improving codegen to resolve issues of this sort; my entire prior comment, excepting the first sentence, should make this clear. My "we don't consider these bugs" comment was simply a matter of ontology.

SergioBenitez avatar Sep 03 '22 06:09 SergioBenitez

My apologies if this came across condescending. That's not the intention. I don't agree with your statement but I also think we both have made our points already.

toxeus avatar Sep 03 '22 08:09 toxeus