-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
(Preliminary) Results of building rust with clippy #278
Comments
This probably is a mismatch; the method doesn't look panicky. Compile rustc-stage1, compile clippy with rustc-stage1 (use multirust), and then do |
Yeah, probably. I'm in the process of installing multirust. I'll report back once I have more results. |
More results – it appears I've run into the same problem as Manish on servo (also some false positives that should be removed in the meantime). I'll update and run again. Btw. if someone intends to replicate this, one first needs to One thing I found very interesting:
Isn't that a false positive here? |
Yes. This is probably because we don't consider casts in our framework. But perhaps we should ignore this after verifying that casts indeed are the reason. |
It might be possible to make use of Clippy's structured logging feature to output the lints as JSON and autofix them. For example, knowing that there's an elision issue on a range of line numbers, we may fix it via python or something. |
My lifetime-applying script is: while read in; do
IFS=: read file line <<< "$in";
#echo $file;
#echo $line;
(sed -n -e "${line}p" $file | grep "Pattern" >/dev/null) || (
sed -i "${line}s/\&'a /\&/g" $file;
sed -i "${line}s/\&'a/\&/g" $file;
sed -i "${line}s/'a, //g" $file;
sed -i "${line}s/'a,//g" $file;
sed -i "${line}s/<'a>//g" $file;
(sed -n -e "${line}p" $file | grep "'a" >/dev/null) && (echo $file; echo $line);
);
done <lifetimesln where Far from perfect, but it handles most cases, and prints out whatever it can't handle. |
What about lifetimes with other names than |
/me was lazy |
😄
Might work, but i think there might be a clash with char literals. For example |
Ideally, we should add JSON logging of specific lints. Eg the lifetime elision will log fileline info (preferably notify if the FnDecl is multiline, but that's hard), and the elidable lifetimes. |
I'm also unsure if this could constitute a false positive:
But this surely does:
(it appears unit_cmp needs an By the way, I revisited the |
I've tried to replicate my findings with a current Rust, but failed because I couldn't compile clippy with a stage1 toolchain, because it didn't find the syntax crate. I'll try and rebuild the toolchain. |
You need to first |
It seems like everything has changed since this was opened 😄 |
I was able to check the
libfmt_macros
crate with clippy and found onestr_to_string
, onewhile_let_loop
and a fewunneeded_return_statement
s.Checking the
libsyntax
crate failed with the following stack trace:This may be due to a mismatch between the stage0 compiler and the compiler with which I built clippy, but I'm not sure.
Trying to check librustc with clippy causes a Segmentation fault on my system.
I'll try to check other rustc/std crates with clippy.
The text was updated successfully, but these errors were encountered: