Skip to content

Unable to Refer to Clippy Lints on Beta #54406

@etaoins

Description

@etaoins
Contributor

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.

Activity

joelgallant

joelgallant commented on Sep 20, 2018

@joelgallant
Contributor

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

etaoins commented on Sep 20, 2018

@etaoins
ContributorAuthor
etaoins

etaoins commented on Oct 13, 2018

@etaoins
ContributorAuthor

This should be fixed by #54870

sdroege

sdroege commented on Nov 9, 2018

@sdroege
Contributor

@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

Mark-Simulacrum commented on Nov 9, 2018

@Mark-Simulacrum
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @sdroege@etaoins@joelgallant@Mark-Simulacrum

        Issue actions

          Unable to Refer to Clippy Lints on Beta · Issue #54406 · rust-lang/rust