mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-22 20:53:21 +00:00
run cargo dev new_lint then move transmutes_expressible_as_ptr_casts into transmute module
This commit is contained in:
parent
24a6130da2
commit
5e84b8c2fb
5 changed files with 39 additions and 0 deletions
|
@ -1730,6 +1730,7 @@ Released 2018-09-13
|
|||
[`transmute_int_to_float`]: https://rust-lang.github.io/rust-clippy/master/index.html#transmute_int_to_float
|
||||
[`transmute_ptr_to_ptr`]: https://rust-lang.github.io/rust-clippy/master/index.html#transmute_ptr_to_ptr
|
||||
[`transmute_ptr_to_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#transmute_ptr_to_ref
|
||||
[`transmutes_expressible_as_ptr_casts`]: https://rust-lang.github.io/rust-clippy/master/index.html#transmutes_expressible_as_ptr_casts
|
||||
[`transmuting_null`]: https://rust-lang.github.io/rust-clippy/master/index.html#transmuting_null
|
||||
[`trivial_regex`]: https://rust-lang.github.io/rust-clippy/master/index.html#trivial_regex
|
||||
[`trivially_copy_pass_by_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
|
||||
|
|
|
@ -798,6 +798,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
|||
&transmute::UNSOUND_COLLECTION_TRANSMUTE,
|
||||
&transmute::USELESS_TRANSMUTE,
|
||||
&transmute::WRONG_TRANSMUTE,
|
||||
&transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS,
|
||||
&transmuting_null::TRANSMUTING_NULL,
|
||||
&trivially_copy_pass_by_ref::TRIVIALLY_COPY_PASS_BY_REF,
|
||||
&try_err::TRY_ERR,
|
||||
|
@ -1426,6 +1427,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
|||
LintId::of(&transmute::TRANSMUTE_PTR_TO_REF),
|
||||
LintId::of(&transmute::UNSOUND_COLLECTION_TRANSMUTE),
|
||||
LintId::of(&transmute::WRONG_TRANSMUTE),
|
||||
LintId::of(&transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS),
|
||||
LintId::of(&transmuting_null::TRANSMUTING_NULL),
|
||||
LintId::of(&try_err::TRY_ERR),
|
||||
LintId::of(&types::ABSURD_EXTREME_COMPARISONS),
|
||||
|
@ -1624,6 +1626,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
|
|||
LintId::of(&transmute::TRANSMUTE_INT_TO_FLOAT),
|
||||
LintId::of(&transmute::TRANSMUTE_PTR_TO_PTR),
|
||||
LintId::of(&transmute::TRANSMUTE_PTR_TO_REF),
|
||||
LintId::of(&transmute::TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS),
|
||||
LintId::of(&types::BORROWED_BOX),
|
||||
LintId::of(&types::CHAR_LIT_AS_U8),
|
||||
LintId::of(&types::TYPE_COMPLEXITY),
|
||||
|
|
|
@ -269,6 +269,28 @@ declare_clippy_lint! {
|
|||
correctness,
|
||||
"transmute between collections of layout-incompatible types"
|
||||
}
|
||||
|
||||
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 TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS,
|
||||
complexity,
|
||||
"default lint description"
|
||||
}
|
||||
|
||||
declare_lint_pass!(Transmute => [
|
||||
CROSSPOINTER_TRANSMUTE,
|
||||
TRANSMUTE_PTR_TO_REF,
|
||||
|
@ -281,6 +303,7 @@ declare_lint_pass!(Transmute => [
|
|||
TRANSMUTE_INT_TO_FLOAT,
|
||||
TRANSMUTE_FLOAT_TO_INT,
|
||||
UNSOUND_COLLECTION_TRANSMUTE,
|
||||
TRANSMUTES_EXPRESSIBLE_AS_PTR_CASTS,
|
||||
]);
|
||||
|
||||
// used to check for UNSOUND_COLLECTION_TRANSMUTE
|
||||
|
|
|
@ -2215,6 +2215,13 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
|
|||
deprecation: None,
|
||||
module: "transmute",
|
||||
},
|
||||
Lint {
|
||||
name: "transmutes_expressible_as_ptr_casts",
|
||||
group: "complexity",
|
||||
desc: "default lint description",
|
||||
deprecation: None,
|
||||
module: "transmute",
|
||||
},
|
||||
Lint {
|
||||
name: "transmuting_null",
|
||||
group: "correctness",
|
||||
|
|
5
tests/ui/transmutes_expressible_as_ptr_casts.rs
Normal file
5
tests/ui/transmutes_expressible_as_ptr_casts.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
#![warn(clippy::transmutes_expressible_as_ptr_casts)]
|
||||
|
||||
fn main() {
|
||||
// test code goes here
|
||||
}
|
Loading…
Reference in a new issue