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

Unable to Refer to Clippy Lints on Beta #54406

Closed
etaoins opened this issue Sep 20, 2018 · 5 comments
Closed

Unable to Refer to Clippy Lints on Beta #54406

etaoins opened this issue Sep 20, 2018 · 5 comments

Comments

@etaoins
Copy link
Contributor

etaoins commented Sep 20, 2018

My existing code has:

#[allow(unreadable_literal)]

Which produces this warning on the beta channel:

lint name `unreadable_literal` is deprecated and may not have an effect in the future. Also `cfg_attr(cargo-clippy)` won't be necessary anymore

note: #[warn(renamed_and_removed_lints)] on by default
help: change it to: `clippy::unreadable_literal`

However, changing it to clippy::unreadable_literal causes the following:

scoped lint `clippy::unreadable_literal` is experimental (see issue #44690)

On nightly #![feature(tool_lints)] can be used as an escape hatch but that's not an option on beta.

IMO neither Nightly nor Beta should generate warnings to change code to something that requires a feature flag. The existing code was valid for the stable features of the language.

@joelgallant
Copy link
Contributor

joelgallant commented Sep 20, 2018

The offending lint is here in beta:

Err((Some(ids), new_lint_name)) => {
let lint = builtin::RENAMED_AND_REMOVED_LINTS;
let (lvl, src) =
self.sets
.get_lint_level(lint, self.cur, Some(&specs), &sess);
let msg = format!(
"lint name `{}` is deprecated \
and may not have an effect in the future. \
Also `cfg_attr(cargo-clippy)` won't be necessary anymore",
name
);
let mut err = lint::struct_lint_level(
self.sess,
lint,
lvl,
src,
Some(li.span.into()),
&msg,
);
err.span_suggestion_with_applicability(
li.span,
"change it to",
new_lint_name.to_string(),
Applicability::MachineApplicable,
).emit();
let src = LintSource::Node(Symbol::intern(&new_lint_name), li.span);
for id in ids {
specs.insert(*id, (level, src));
}
}

It appears to be different (and not "may not", but rather "will not") in nightly.

@etaoins
Copy link
Contributor Author

etaoins commented Sep 20, 2018

cc #44690

@etaoins
Copy link
Contributor Author

etaoins commented Oct 13, 2018

This should be fixed by #54870

@etaoins etaoins closed this as completed Oct 13, 2018
@sdroege
Copy link
Contributor

sdroege commented Nov 9, 2018

@etaoins This is still not optimal: it's not possible to silence the warning, and doing what the warning suggests makes compilation fail with current stable and older releases.

As such, running nightly clippy (and soon stable clippy) will always produce warnings unless the codebase drops support for an older toolchain version.

@Mark-Simulacrum
Copy link
Member

I'm going to reopen this so that we can look and see if there's some warning-free way of doing this.

ysimonson added a commit to ysimonson/capnproto-rust that referenced this issue Nov 19, 2018
vhdirk pushed a commit to vhdirk/capnproto-rust that referenced this issue May 8, 2019
ErikMcClure pushed a commit to Fundament-Software/capstone-rs that referenced this issue Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants