Skip to content

Commit 5a64496

Browse files
committed
run cargo dev new_lint
specifically: cargo dev new_lint --name derive_ord_xor_partial_ord --category correctness --pass late
1 parent f5d429c commit 5a64496

File tree

5 files changed

+45
-0
lines changed

5 files changed

+45
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,6 +1454,7 @@ Released 2018-09-13
14541454
[`deprecated_semver`]: https://rust-lang.github.io/rust-clippy/master/index.html#deprecated_semver
14551455
[`deref_addrof`]: https://rust-lang.github.io/rust-clippy/master/index.html#deref_addrof
14561456
[`derive_hash_xor_eq`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_hash_xor_eq
1457+
[`derive_ord_xor_partial_ord`]: https://rust-lang.github.io/rust-clippy/master/index.html#derive_ord_xor_partial_ord
14571458
[`diverging_sub_expression`]: https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression
14581459
[`doc_markdown`]: https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
14591460
[`double_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#double_comparisons
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
use rustc_lint::{LateLintPass, LateContext};
2+
use rustc_session::{declare_lint_pass, declare_tool_lint};
3+
use rustc_hir::*;
4+
5+
declare_clippy_lint! {
6+
/// **What it does:**
7+
///
8+
/// **Why is this bad?**
9+
///
10+
/// **Known problems:** None.
11+
///
12+
/// **Example:**
13+
///
14+
/// ```rust
15+
/// // example code where clippy issues a warning
16+
/// ```
17+
/// Use instead:
18+
/// ```rust
19+
/// // example code which does not raise clippy warning
20+
/// ```
21+
pub DERIVE_ORD_XOR_PARTIAL_ORD,
22+
correctness,
23+
"default lint description"
24+
}
25+
26+
declare_lint_pass!(DeriveOrdXorPartialOrd => [DERIVE_ORD_XOR_PARTIAL_ORD]);
27+
28+
impl LateLintPass<'_, '_> for DeriveOrdXorPartialOrd {}

clippy_lints/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ mod dbg_macro;
173173
mod default_trait_access;
174174
mod dereference;
175175
mod derive;
176+
mod derive_ord_xor_partial_ord;
176177
mod doc;
177178
mod double_comparison;
178179
mod double_parens;
@@ -515,6 +516,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
515516
&derive::DERIVE_HASH_XOR_EQ,
516517
&derive::EXPL_IMPL_CLONE_ON_COPY,
517518
&derive::UNSAFE_DERIVE_DESERIALIZE,
519+
&derive_ord_xor_partial_ord::DERIVE_ORD_XOR_PARTIAL_ORD,
518520
&doc::DOC_MARKDOWN,
519521
&doc::MISSING_ERRORS_DOC,
520522
&doc::MISSING_SAFETY_DOC,
@@ -1230,6 +1232,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
12301232
LintId::of(&copies::IFS_SAME_COND),
12311233
LintId::of(&copies::IF_SAME_THEN_ELSE),
12321234
LintId::of(&derive::DERIVE_HASH_XOR_EQ),
1235+
LintId::of(&derive_ord_xor_partial_ord::DERIVE_ORD_XOR_PARTIAL_ORD),
12331236
LintId::of(&doc::MISSING_SAFETY_DOC),
12341237
LintId::of(&doc::NEEDLESS_DOCTEST_MAIN),
12351238
LintId::of(&double_comparison::DOUBLE_COMPARISONS),
@@ -1648,6 +1651,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
16481651
LintId::of(&copies::IFS_SAME_COND),
16491652
LintId::of(&copies::IF_SAME_THEN_ELSE),
16501653
LintId::of(&derive::DERIVE_HASH_XOR_EQ),
1654+
LintId::of(&derive_ord_xor_partial_ord::DERIVE_ORD_XOR_PARTIAL_ORD),
16511655
LintId::of(&drop_bounds::DROP_BOUNDS),
16521656
LintId::of(&drop_forget_ref::DROP_COPY),
16531657
LintId::of(&drop_forget_ref::DROP_REF),

src/lintlist/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,13 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
360360
deprecation: None,
361361
module: "derive",
362362
},
363+
Lint {
364+
name: "derive_ord_xor_partial_ord",
365+
group: "correctness",
366+
desc: "default lint description",
367+
deprecation: None,
368+
module: "derive_ord_xor_partial_ord",
369+
},
363370
Lint {
364371
name: "diverging_sub_expression",
365372
group: "complexity",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#![warn(clippy::derive_ord_xor_partial_ord)]
2+
3+
fn main() {
4+
// test code goes here
5+
}

0 commit comments

Comments
 (0)