Skip to content

Commit

Permalink
auto merge of #18044 : aturon/rust/lint-conventions, r=pcwalton
Browse files Browse the repository at this point in the history
[RFC 344](rust-lang/rfcs#344) proposes a set of naming conventions for lints. This PR
renames existing lints to follow the conventions.

Use the following sed script to bring your code up to date:

```
s/unnecessary_typecast/unused_typecasts/g
s/unsigned_negate/unsigned_negation/g
s/type_limits/unused_comparisons/g
s/type_overflow/overflowing_literals/g
s/ctypes/improper_ctypes/g
s/owned_heap_memory/box_pointers/g
s/unused_attribute/unused_attributes/g
s/path_statement/path_statements/g
s/unused_must_use/unused_must_use/g
s/unused_result/unused_results/g
s/non_uppercase_statics/non_upper_case_globals/g
s/unnecessary_parens/unused_parens/g
s/unnecessary_import_braces/unused_import_braces/g
s/unused_unsafe/unused_unsafe/g
s/unsafe_block/unsafe_blocks/g
s/unused_mut/unused_mut/g
s/unnecessary_allocation/unused_allocation/g
s/missing_doc/missing_docs/g
s/unused_imports/unused_imports/g
s/unused_extern_crate/unused_extern_crates/g
s/unnecessary_qualification/unused_qualifications/g
s/unrecognized_lint/unknown_lints/g
s/unused_variable/unused_variables/g
s/dead_assignment/unused_assignments/g
s/unknown_crate_type/unknown_crate_types/g
s/variant_size_difference/variant_size_differences/g
s/transmute_fat_ptr/fat_ptr_transmutes/g
```

Since a large number of lints are being renamed for RFC 344, this PR
adds some basic deprecation/renaming functionality to the pluggable lint
system. It allows a simple mapping of old to new names, and can warn
when old names are being used.

This change needs to be rolled out in stages. In this PR, the
deprecation warning is commented out, but the old name is forwarded to
the new one.

Once the PR lands and we have generated a new snapshot of the
compiler, we can add the deprecation warning and rename all uses of the
lints in the rust codebase. I will file a PR to do so.

Closes #16545
Closes #17932

r? @pcwalton
  • Loading branch information
bors committed Oct 15, 2014
2 parents af99157 + 31b7d64 commit ea8a5df
Show file tree
Hide file tree
Showing 7 changed files with 191 additions and 126 deletions.
4 changes: 2 additions & 2 deletions src/librustc/driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,15 +704,15 @@ pub fn collect_crate_types(session: &Session,
}
Some(ref n) if n.equiv(&("bin")) => Some(config::CrateTypeExecutable),
Some(_) => {
session.add_lint(lint::builtin::UNKNOWN_CRATE_TYPE,
session.add_lint(lint::builtin::UNKNOWN_CRATE_TYPES,
ast::CRATE_NODE_ID,
a.span,
"invalid `crate_type` \
value".to_string());
None
}
_ => {
session.add_lint(lint::builtin::UNKNOWN_CRATE_TYPE,
session.add_lint(lint::builtin::UNKNOWN_CRATE_TYPES,
ast::CRATE_NODE_ID,
a.span,
"`crate_type` requires a \
Expand Down
Loading

0 comments on commit ea8a5df

Please sign in to comment.