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

force full re-clippy #2604

Open
davemilter opened this Issue Apr 1, 2018 · 14 comments

Comments

Projects
None yet
@davemilter
Copy link

davemilter commented Apr 1, 2018

I build clippy from git sources (4ef7238).
This is re-open of #2498 as @oli-obk suggested.
And actully nothing changes because of #2582 , and why it should?

Sample code:

use std::io;

pub fn map_err(err: io::Error) -> String {
    format!("{}", err)
}
$ cargo clippy
   Compiling foo v0.1.0 (file:///tmp/foo)
warning: this argument is passed by value, but not consumed in the function body
 --> src/lib.rs:3:21
  |
3 | pub fn map_err(err: io::Error) -> String {
  |                     ^^^^^^^^^ help: consider taking a reference instead: `&io::Error`
  |
  = note: #[warn(needless_pass_by_value)] on by default
  = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.191/index.html#needless_pass_by_value

    Finished dev [unoptimized + debuginfo] target(s) in 0.14 secs
$ cargo clippy
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs

As you use the second run of clippy gives nothing, and cargo clippy --help
have no options to force rerun.

@matthiaskrgr

This comment has been minimized.

Copy link
Collaborator

matthiaskrgr commented Apr 1, 2018

I usually work around this by runnning something like touch src/main.rs ; cargo clippy

@oli-obk

This comment has been minimized.

Copy link
Collaborator

oli-obk commented May 20, 2018

can you try with clippy 0.0.203? I included a possible fix there

@CyrilCalmels

This comment has been minimized.

Copy link

CyrilCalmels commented May 20, 2018

I still have the issue with clippy 0.0.203 😢

@baumanj

This comment has been minimized.

Copy link

baumanj commented May 25, 2018

Also seeing this with v0.0.204

@Manishearth

This comment has been minimized.

Copy link
Member

Manishearth commented Jul 25, 2018

cc @alexcrichton is there any way we can get a mode to cargo check that always rebuilds the toplevel crate (i.e. the root, or if running -p, that crate). Preferably not clobbering artefacts unless they need to be.

@dwijnand

This comment has been minimized.

Copy link
Member

dwijnand commented Jul 25, 2018

@killercup is fixing the same bug that cargo fix has over in rust-lang/cargo#5750, which I'm hopeful will make fixing this much easier.

@killercup

This comment has been minimized.

Copy link
Member

killercup commented Jul 25, 2018

@JoshMcguigan

This comment has been minimized.

Copy link
Contributor

JoshMcguigan commented Sep 18, 2018

rust-lang/cargo#5944 was merged, which is a rebase of killercup's work. I'd be open to working on a fix for this, if there is anyone who can provide guidance on what is needed from the clippy side?

@matthiaskrgr

This comment has been minimized.

Copy link
Collaborator

matthiaskrgr commented Sep 23, 2018

If the cargo folks agree, perhaps we could have commandline arg in cargo which forces the package to be rebuilt. (cargo check -f / --force or something like that).
I guess the flag then needs to be hooked up in.
https://github.com/rust-lang-nursery/rust-clippy/blob/master/src/main.rs#L103-L111

We would somehow need to make sure it only forces recheck of the crates in the current workspace and not all dependencies as well, not sure what is the best way to do this though.. :/

@BatmanAoD

This comment has been minimized.

Copy link

BatmanAoD commented Feb 14, 2019

Even something as simple as detecting that no work has been done and outputting a warning suggesting the user touch the root file would improve the user experience drastically, I think.

I believe the ideal solution is a diagnostic-caching mechanism, but currently users have no indication that cargo build && cargo clippy is a misuse of Clippy, or that their code may have lint warnings or errors that they're not seeing.

@JoshMcguigan

This comment has been minimized.

Copy link
Contributor

JoshMcguigan commented Feb 14, 2019

I just submitted rust-lang/cargo#6664 to cargo to force cargo check to rebuild. There may be some additional work needed there, but hopefully that will move this issue forward.

@JoshMcguigan

This comment has been minimized.

Copy link
Contributor

JoshMcguigan commented Feb 16, 2019

It seems rust-lang/cargo#6664 is close to getting merged. It would be helpful if someone familiar with how clippy integrates with cargo could check in and confirm this would solve the clippy use case.

@Manishearth

This comment has been minimized.

Copy link
Member

Manishearth commented Feb 17, 2019

Yes, but we may need to pass a flag down

@crlf0710

This comment has been minimized.

Copy link

crlf0710 commented Feb 23, 2019

Encountered this problem - when i run clippy twice with different parameters, the program didn't get rebuilt, so i got no output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.