rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

Add [`extern_without_abi`] lint

Open CBSpeir opened this issue 1 year ago • 7 comments

Fixes #13372

The [extern_without_abi] lint emits when extern is not followed by an ABI. For example:

// EMIT
extern fn foo() {}

// EMIT
extern {
    fn bar();
}

// NO EMIT
extern "C" fn baz() {}

// NO EMIT
extern "C" {
    fn foo_bar();
}

changelog: Add [extern_without_abi] lint

CBSpeir avatar Sep 16 '24 19:09 CBSpeir

r? @Centri3

rustbot has assigned @Centri3. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rustbot avatar Sep 16 '24 19:09 rustbot

:umbrella: The latest upstream changes (presumably #13322) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Sep 22 '24 14:09 bors

:umbrella: The latest upstream changes (presumably #13440) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Sep 22 '24 19:09 bors

Thank you for reviewing the PR. It should include the changes you requested. I went ahead and squashed and merged the changes with the latest from master.

CBSpeir avatar Sep 23 '24 06:09 CBSpeir

:umbrella: The latest upstream changes (presumably #13334) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Oct 13 '24 07:10 bors

:umbrella: The latest upstream changes (presumably #13395) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Oct 15 '24 16:10 bors

In addition to fixing the merge conflicts, I moved is_from_proc_macro test to last since it seems to be the most expensive. Also made a minor change to a string literal to improve readability.

CBSpeir avatar Oct 15 '24 18:10 CBSpeir

There's the missing_abi rustc lint that sounds like the same as what this adds, or is there a difference? rust-lang/rust#132397 makes that rustc lint warn-by-default

y21 avatar Oct 31 '24 11:10 y21

I guess missing_abi already checks for this, and therefore this PR isn't needed.

There is one difference, this lint emits a diagnostic with a suggestion. I don't believe missing_abi does.

CBSpeir avatar Nov 01 '24 02:11 CBSpeir