maghoff / bart

A compile time templating language for Rust inspired by Mustache
https://crates.io/crates/bart
MIT License
37 stars 7 forks source link

Clippy Lints #17

Closed huntiep closed 7 years ago

huntiep commented 7 years ago

Have you considered running clippy? Right now if you run clippy on a project using bart you get a lot (a few hundred lines) of warnings originating with bart. I've fixed all but one of clippy's lints here, but I'm not sure what to do about the final lint. I don't think it can be fixed because it's with codegen.

I can submit a patch if you would like.

maghoff commented 7 years ago

Hi, thanks!

I should probably get around to running clippy, yeah.

I haven't looked into clippy with Bart specifically, but it is usually the case that generated code needs to do some things in less than ideal ways, typically because the code generator wants to be generic while the lint wants to be specific. Maybe the best way out of this is to disable clippy for the generated code, but I'll certainly look into what it has to say :)

If you're up for it, I'm ready to accept a pull request for a patch that does not make changes to the generated code. I want to look more closely at changes to the generated code.

Thanks for bringing this to my attention :)

maghoff commented 7 years ago

I ended up fixing most of the lints and disabling clippy for the generated code. Especially in the iterator cases the generated code needs to continue working with arbitrary iterators, so the generated code is indeed non-ideal for many cases. This is not a symptom of broken code, it is just a false positive for the lint :)

Thanks again :)