Skip to content

Commit

Permalink
Auto merge of #5300 - JohnTitor:edition-flag, r=flip1995
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Mar 10, 2020
2 parents 23bd427 + d4eb496 commit 9d5ffe8
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 10 deletions.
7 changes: 5 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/doc_errors.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-flags: --edition 2018
// edition:2018
#![warn(clippy::missing_errors_doc)]

use std::io;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/issue_4266.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-flags: --edition 2018
// edition:2018
#![allow(dead_code)]

async fn sink1<'a>(_: &'a str) {} // lint
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/macro_use_imports.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// compile-flags: --edition 2018
// edition:2018
#![warn(clippy::macro_use_imports)]

use std::collections::HashMap;
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/methods.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// aux-build:option_helpers.rs
// compile-flags: --edition 2018
// edition:2018

#![warn(clippy::all, clippy::pedantic)]
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/single_component_path_imports.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
// compile-flags: --edition 2018
// edition:2018
#![warn(clippy::single_component_path_imports)]
#![allow(unused_imports)]

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/single_component_path_imports.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
// compile-flags: --edition 2018
// edition:2018
#![warn(clippy::single_component_path_imports)]
#![allow(unused_imports)]

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/use_self.fixed
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
// compile-flags: --edition 2018
// edition:2018

#![warn(clippy::use_self)]
#![allow(dead_code)]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/use_self.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// run-rustfix
// compile-flags: --edition 2018
// edition:2018

#![warn(clippy::use_self)]
#![allow(dead_code)]
Expand Down

0 comments on commit 9d5ffe8

Please sign in to comment.