Skip to content

Add lint for wrong attributes - #10316

Merged
bors merged 8 commits into
rust-lang:masterfrom
klutzy:attr-lint
Nov 26, 2013
Merged

bors merged 8 commits into
rust-lang:masterfrom
klutzy:attr-lint

Conversation

@klutzy

@klutzy klutzy commented Nov 6, 2013

Copy link
Copy Markdown
Contributor

This patchset makes warning if crate-level attribute is used at other places, obsolete attributed is used, or unknown attribute is used, since they are usually from mistakes.

Closes #3348

Comment thread src/librustc/middle/lint.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may also want to include

  • no_implicit_prelude
  • license

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no_implicit_prelude can be used on items:

#[no_implicit_prelude]
mod x {
  fn f() -> Option<int> { None } // error: use of undeclared type name `Option`
}

I initially included license, copyright and comment but I've found we don't use them at all, so I don't know how good including them is.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're not explicitly used anywhere currently, but all crate attributes contribute to the crate hash currently (but that may not stick around very long).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably fine to leave them out for now.

@emberian

Copy link
Copy Markdown
Contributor

@klutzy any progress on this?

@klutzy

klutzy commented Nov 25, 2013

Copy link
Copy Markdown
Contributor Author

I've completely forgot this! I've implemented unknown-attr lint but haven't added tests yet. It also needs update to reflect current attributes.

@klutzy

klutzy commented Nov 25, 2013

Copy link
Copy Markdown
Contributor Author

I think it's done. r?

@emberian

Copy link
Copy Markdown
Contributor

@klutzy needs rebase

@klutzy

klutzy commented Nov 26, 2013

Copy link
Copy Markdown
Contributor Author

rebase done.
It may be worth to note that unknown-attr lint can be improved later (I'm not going to do it now): it might be good if it makes warning for #[deriving(Eq)] on function or #[packed]; on crate.

bors added a commit that referenced this pull request Nov 26, 2013
This patchset makes warning if crate-level attribute is used at other places, obsolete attributed is used, or unknown attribute is used, since they are usually from mistakes.

Closes #3348
@bors bors closed this Nov 26, 2013
@bors
bors merged commit fa2077a into rust-lang:master Nov 26, 2013
@klutzy
klutzy deleted the attr-lint branch November 26, 2013 06:58
zargony pushed a commit to zargony/fuse-rs that referenced this pull request Nov 26, 2013
…lang/rust#10316. Also moved comment attr to desc which seems more appropriate.
Jarcho pushed a commit to Jarcho/rust that referenced this pull request Feb 26, 2023
… r=Manishearth

Add `suspicious_command_arg_space` lint

Fixes rust-lang#10316

---

changelog: New lint: [`suspicious_command_arg_space`]
[rust-lang#10317](rust-lang/rust-clippy#10317)
<!-- changelog_checked -->
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

Successfully merging this pull request may close these issues.

ignored link and crate_type attributes

6 participants