1 // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 //! Some lints that are built in to the compiler.
13 //! These are the built-in lints that are emitted direct in the main
14 //! compiler code, rather than using their own custom pass. Those
15 //! lints are all available in `rustc_lint::builtin`.
17 use lint::{LintPass, LateLintPass, LintArray};
22 "imports that are never used"
26 pub UNUSED_EXTERN_CRATES,
28 "extern crates that are never used"
32 pub UNUSED_QUALIFICATIONS,
34 "detects unnecessarily qualified names"
40 "unrecognized lint attribute"
46 "detect variables which are not used in any way"
50 pub UNUSED_ASSIGNMENTS,
52 "detect assignments that will never be read"
58 "detect unused, unexported items"
64 "detects unreachable code paths"
70 "mass-change the level for lints which produce warnings"
76 "unused or unknown features found in crate-level #[feature] directives"
82 "stable features found in #[feature] directive"
86 pub UNKNOWN_CRATE_TYPES,
88 "unknown crate type found in #[crate_type] directive"
92 pub VARIANT_SIZE_DIFFERENCES,
94 "detects enums with widely varying variant sizes"
98 pub FAT_PTR_TRANSMUTES,
100 "detects transmutes of fat pointers"
106 "detects trivial casts which could be removed"
110 pub TRIVIAL_NUMERIC_CASTS,
112 "detects trivial casts of numeric types which could be removed"
114 /// Does nothing as a lint pass, but registers some `Lint`s
115 /// which are used by other parts of the compiler.
116 #[derive(Copy, Clone)]
117 pub struct HardwiredLints;
119 impl LintPass for HardwiredLints {
120 fn get_lints(&self) -> LintArray {
123 UNUSED_EXTERN_CRATES,
124 UNUSED_QUALIFICATIONS,
134 VARIANT_SIZE_DIFFERENCES,
137 TRIVIAL_NUMERIC_CASTS
142 impl LateLintPass for HardwiredLints {}