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

Clippy is linting stuff from ./target too? #14073

Closed
dpc opened this issue Jan 24, 2025 · 5 comments
Closed

Clippy is linting stuff from ./target too? #14073

dpc opened this issue Jan 24, 2025 · 5 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@dpc
Copy link

dpc commented Jan 24, 2025

Summary

I'm upgrading the toolchain to 1.84.0 and after fixing all the new lints in our own project I'm getting lint problems from file out-generated by unitffi inside target directory:

warning: empty lines after doc comment
  --> /home/dpc/lab/fedi/fedi/target-nix/debug/build/fedi-ffi-ec51c3001ea838f7/out/fedi.uniffi.rs:9:1
   |
9  | / /// See `uniffi_bindgen::macro_metadata` for how this is used.
10 | |
11 | | // ditto for info about the UDL which spawned us.
12 | |
   | |_^
13 |   const UNIFFI_META_CONST_UDL_FEDI: ::uniffi::MetadataBuffer = ::uniffi::MetadataBuffer::from_c...
   |   ---------------------------------------------------------- the comment documents this constant

I'll figure out a way to bandaid it, but I'm surprised that clippy even bothers looking there. I hope it's not scanning that dir or something - seems like a waste of time. And most of all - I can't really fix lints in code that comes from another project.

Reproducer

NA

Version

rustc 1.84.0 (9fc6b4312 2025-01-07)
binary: rustc
commit-hash: 9fc6b43126469e3858e2fe86cafb4f0fd5068869
commit-date: 2025-01-07
host: x86_64-unknown-linux-gnu
release: 1.84.0
LLVM version: 19.1.5

Additional Labels

No response

@dpc dpc added the C-bug Category: Clippy is not doing the correct thing label Jan 24, 2025
@dpc
Copy link
Author

dpc commented Jan 24, 2025

The problem was already reported to the uniffi: mozilla/uniffi-rs#2346 , but I think clippy should just not lint things there? Feel free to close, just making sure this has been considered.

@dpc dpc changed the title Clippy is linting stuff from ./target too?! Clippy is linting stuff from ./target too? Jan 24, 2025
@samueltardieu
Copy link
Contributor

Note that Clippy lints this file because it has been included verbatim in the project, e.g., via an `include_str!() macro call. It doesn't actively look for files, and lints what rustc tells it to lint.

@dpc
Copy link
Author

dpc commented Jan 24, 2025

Right. Makes sense. So I guess the question still is - should clippy just ignore stuff from target as autogenerated. Possibly not, I guess some projects might be generating their own code and would like it linted too?

@samueltardieu
Copy link
Contributor

I guess some projects might be generating their own code and would like it linted too?

Yes. Isn't it what you're doing with uniffi-rs? Doesn't you have your own build script which calls uniffi-rs generation function? That would amount to your build script generating the file.

@dpc
Copy link
Author

dpc commented Jan 24, 2025

OK. I guess.

@dpc dpc closed this as completed Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

No branches or pull requests

2 participants