Run cargo dev new_lint
This commit is contained in:
@@ -1877,6 +1877,7 @@ Released 2018-09-13
|
|||||||
[`box_vec`]: https://rust-lang.github.io/rust-clippy/master/index.html#box_vec
|
[`box_vec`]: https://rust-lang.github.io/rust-clippy/master/index.html#box_vec
|
||||||
[`boxed_local`]: https://rust-lang.github.io/rust-clippy/master/index.html#boxed_local
|
[`boxed_local`]: https://rust-lang.github.io/rust-clippy/master/index.html#boxed_local
|
||||||
[`builtin_type_shadow`]: https://rust-lang.github.io/rust-clippy/master/index.html#builtin_type_shadow
|
[`builtin_type_shadow`]: https://rust-lang.github.io/rust-clippy/master/index.html#builtin_type_shadow
|
||||||
|
[`capitalized_acronyms`]: https://rust-lang.github.io/rust-clippy/master/index.html#capitalized_acronyms
|
||||||
[`cargo_common_metadata`]: https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata
|
[`cargo_common_metadata`]: https://rust-lang.github.io/rust-clippy/master/index.html#cargo_common_metadata
|
||||||
[`case_sensitive_file_extension_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#case_sensitive_file_extension_comparisons
|
[`case_sensitive_file_extension_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#case_sensitive_file_extension_comparisons
|
||||||
[`cast_lossless`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
|
[`cast_lossless`]: https://rust-lang.github.io/rust-clippy/master/index.html#cast_lossless
|
||||||
|
|||||||
28
clippy_lints/src/capitalized_acronyms.rs
Normal file
28
clippy_lints/src/capitalized_acronyms.rs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
use rustc_lint::{EarlyLintPass, EarlyContext};
|
||||||
|
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||||
|
use rustc_ast::ast::*;
|
||||||
|
|
||||||
|
declare_clippy_lint! {
|
||||||
|
/// **What it does:**
|
||||||
|
///
|
||||||
|
/// **Why is this bad?**
|
||||||
|
///
|
||||||
|
/// **Known problems:** None.
|
||||||
|
///
|
||||||
|
/// **Example:**
|
||||||
|
///
|
||||||
|
/// ```rust
|
||||||
|
/// // example code where clippy issues a warning
|
||||||
|
/// ```
|
||||||
|
/// Use instead:
|
||||||
|
/// ```rust
|
||||||
|
/// // example code which does not raise clippy warning
|
||||||
|
/// ```
|
||||||
|
pub CAPITALIZED_ACRONYMS,
|
||||||
|
style,
|
||||||
|
"default lint description"
|
||||||
|
}
|
||||||
|
|
||||||
|
declare_lint_pass!(CapitalizedAcronyms => [CAPITALIZED_ACRONYMS]);
|
||||||
|
|
||||||
|
impl EarlyLintPass for CapitalizedAcronyms {}
|
||||||
@@ -169,6 +169,7 @@ mod blacklisted_name;
|
|||||||
mod blocks_in_if_conditions;
|
mod blocks_in_if_conditions;
|
||||||
mod booleans;
|
mod booleans;
|
||||||
mod bytecount;
|
mod bytecount;
|
||||||
|
mod capitalized_acronyms;
|
||||||
mod cargo_common_metadata;
|
mod cargo_common_metadata;
|
||||||
mod case_sensitive_file_extension_comparisons;
|
mod case_sensitive_file_extension_comparisons;
|
||||||
mod checked_conversions;
|
mod checked_conversions;
|
||||||
@@ -559,6 +560,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
|||||||
&booleans::LOGIC_BUG,
|
&booleans::LOGIC_BUG,
|
||||||
&booleans::NONMINIMAL_BOOL,
|
&booleans::NONMINIMAL_BOOL,
|
||||||
&bytecount::NAIVE_BYTECOUNT,
|
&bytecount::NAIVE_BYTECOUNT,
|
||||||
|
&capitalized_acronyms::CAPITALIZED_ACRONYMS,
|
||||||
&cargo_common_metadata::CARGO_COMMON_METADATA,
|
&cargo_common_metadata::CARGO_COMMON_METADATA,
|
||||||
&case_sensitive_file_extension_comparisons::CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS,
|
&case_sensitive_file_extension_comparisons::CASE_SENSITIVE_FILE_EXTENSION_COMPARISONS,
|
||||||
&checked_conversions::CHECKED_CONVERSIONS,
|
&checked_conversions::CHECKED_CONVERSIONS,
|
||||||
|
|||||||
5
tests/ui/capitalized_acronyms.rs
Normal file
5
tests/ui/capitalized_acronyms.rs
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#![warn(clippy::capitalized_acronyms)]
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// test code goes here
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user