about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-03-10 22:02:41 +0000
committerbors <bors@rust-lang.org>2020-03-10 22:02:41 +0000
commit9d5ffe81054890cafc1f4df20704ebdd597bd2a4 (patch)
tree0fff47a3fbcf831ba98d82152f76d83776bc3af1
parent23bd427f925e44a9244a40187659ca2a2eb0a6ee (diff)
parentd4eb4968560456827e71cdf1a48b5a4585168ec5 (diff)
downloadrust-9d5ffe81054890cafc1f4df20704ebdd597bd2a4.tar.gz
rust-9d5ffe81054890cafc1f4df20704ebdd597bd2a4.zip
Auto merge of #5300 - JohnTitor:edition-flag, r=flip1995
Use `edition:2018` flag more widely

Now we recommend using `// edition:2018`, so let's use it more widely.
Also replace a too old example with new one in the docs.

changelog: none
-rw-r--r--CONTRIBUTING.md7
-rw-r--r--tests/ui/doc_errors.rs2
-rw-r--r--tests/ui/issue_4266.rs2
-rw-r--r--tests/ui/macro_use_imports.rs2
-rw-r--r--tests/ui/methods.rs2
-rw-r--r--tests/ui/single_component_path_imports.fixed2
-rw-r--r--tests/ui/single_component_path_imports.rs2
-rw-r--r--tests/ui/use_self.fixed2
-rw-r--r--tests/ui/use_self.rs2
9 files changed, 13 insertions, 10 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b52266ac4f1..b1f9be44b73 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -54,7 +54,8 @@ and resolved paths.
 [`T-AST`] issues will generally need you to match against a predefined syntax structure.
 To figure out how this syntax structure is encoded in the AST, it is recommended to run
 `rustc -Z ast-json` on an example of the structure and compare with the [nodes in the AST docs].
-Usually the lint will end up to be a nested series of matches and ifs, [like so].
+Usually the lint will end up to be a nested series of matches and ifs, [like so][deep-nesting].
+But we can make it nest-less by using [if_chain] macro, [like this][nest-less].
 
 [`E-medium`] issues are generally pretty easy too, though it's recommended you work on an E-easy issue first.
 They are mostly classified as [`E-medium`], since they might be somewhat involved code wise,
@@ -71,7 +72,9 @@ an AST expression). `match_def_path()` in Clippy's `utils` module can also be us
 [`E-medium`]: https://github.com/rust-lang/rust-clippy/labels/E-medium
 [`ty`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty
 [nodes in the AST docs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_ast/ast/
-[like so]: https://github.com/rust-lang/rust-clippy/blob/de5ccdfab68a5e37689f3c950ed1532ba9d652a0/src/misc.rs#L34
+[deep-nesting]: https://github.com/rust-lang/rust-clippy/blob/557f6848bd5b7183f55c1e1522a326e9e1df6030/clippy_lints/src/mem_forget.rs#L29-L43
+[if_chain]: https://docs.rs/if_chain/*/if_chain
+[nest-less]: https://github.com/rust-lang/rust-clippy/blob/557f6848bd5b7183f55c1e1522a326e9e1df6030/clippy_lints/src/bit_mask.rs#L124-L150
 
 ## Writing code
 
diff --git a/tests/ui/doc_errors.rs b/tests/ui/doc_errors.rs
index 1401a658e03..445fc8d31d7 100644
--- a/tests/ui/doc_errors.rs
+++ b/tests/ui/doc_errors.rs
@@ -1,4 +1,4 @@
-// compile-flags: --edition 2018
+// edition:2018
 #![warn(clippy::missing_errors_doc)]
 
 use std::io;
diff --git a/tests/ui/issue_4266.rs b/tests/ui/issue_4266.rs
index 1538abb1d77..8a9d5a3d1d5 100644
--- a/tests/ui/issue_4266.rs
+++ b/tests/ui/issue_4266.rs
@@ -1,4 +1,4 @@
-// compile-flags: --edition 2018
+// edition:2018
 #![allow(dead_code)]
 
 async fn sink1<'a>(_: &'a str) {} // lint
diff --git a/tests/ui/macro_use_imports.rs b/tests/ui/macro_use_imports.rs
index 094dce17d4b..60c64ee8146 100644
--- a/tests/ui/macro_use_imports.rs
+++ b/tests/ui/macro_use_imports.rs
@@ -1,4 +1,4 @@
-// compile-flags: --edition 2018
+// edition:2018
 #![warn(clippy::macro_use_imports)]
 
 use std::collections::HashMap;
diff --git a/tests/ui/methods.rs b/tests/ui/methods.rs
index bc448435829..2af33b26340 100644
--- a/tests/ui/methods.rs
+++ b/tests/ui/methods.rs
@@ -1,5 +1,5 @@
 // aux-build:option_helpers.rs
-// compile-flags: --edition 2018
+// edition:2018
 
 #![warn(clippy::all, clippy::pedantic)]
 #![allow(
diff --git a/tests/ui/single_component_path_imports.fixed b/tests/ui/single_component_path_imports.fixed
index 9095069b093..a7a8499b58f 100644
--- a/tests/ui/single_component_path_imports.fixed
+++ b/tests/ui/single_component_path_imports.fixed
@@ -1,5 +1,5 @@
 // run-rustfix
-// compile-flags: --edition 2018
+// edition:2018
 #![warn(clippy::single_component_path_imports)]
 #![allow(unused_imports)]
 
diff --git a/tests/ui/single_component_path_imports.rs b/tests/ui/single_component_path_imports.rs
index 1ebb3ee59b8..9a427e90ad3 100644
--- a/tests/ui/single_component_path_imports.rs
+++ b/tests/ui/single_component_path_imports.rs
@@ -1,5 +1,5 @@
 // run-rustfix
-// compile-flags: --edition 2018
+// edition:2018
 #![warn(clippy::single_component_path_imports)]
 #![allow(unused_imports)]
 
diff --git a/tests/ui/use_self.fixed b/tests/ui/use_self.fixed
index 802de31b783..ebb3aa28daf 100644
--- a/tests/ui/use_self.fixed
+++ b/tests/ui/use_self.fixed
@@ -1,5 +1,5 @@
 // run-rustfix
-// compile-flags: --edition 2018
+// edition:2018
 
 #![warn(clippy::use_self)]
 #![allow(dead_code)]
diff --git a/tests/ui/use_self.rs b/tests/ui/use_self.rs
index 605c4f8c41f..8a182192ab3 100644
--- a/tests/ui/use_self.rs
+++ b/tests/ui/use_self.rs
@@ -1,5 +1,5 @@
 // run-rustfix
-// compile-flags: --edition 2018
+// edition:2018
 
 #![warn(clippy::use_self)]
 #![allow(dead_code)]