Skip to content

Commit 574d2b8

Browse files
committed
patterns_in_fns_without_body -> deny
1 parent a12e69d commit 574d2b8

File tree

3 files changed

+41
-41
lines changed

3 files changed

+41
-41
lines changed

src/doc/rustc/src/lints/listing/deny-by-default.md

+40
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,46 @@ error: literal out of range for u8
122122
|
123123
```
124124

125+
## patterns-in-fns-without-body
126+
127+
This lint detects patterns in functions without body were that were
128+
previously erroneously allowed. Some example code that triggers this lint:
129+
130+
```rust,compile_fail
131+
trait Trait {
132+
fn foo(mut arg: u8);
133+
}
134+
```
135+
136+
This will produce:
137+
138+
```text
139+
warning: patterns aren't allowed in methods without bodies
140+
--> src/main.rs:2:12
141+
|
142+
2 | fn foo(mut arg: u8);
143+
| ^^^^^^^
144+
|
145+
= note: `#[warn(patterns_in_fns_without_body)]` on by default
146+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
147+
= note: for more information, see issue #35203 <https://github.com/rust-lang/rust/issues/35203>
148+
```
149+
150+
To fix this, remove the pattern; it can be used in the implementation without
151+
being used in the definition. That is:
152+
153+
```rust
154+
trait Trait {
155+
fn foo(arg: u8);
156+
}
157+
158+
impl Trait for i32 {
159+
fn foo(mut arg: u8) {
160+
161+
}
162+
}
163+
```
164+
125165
## pub-use-of-private-extern-crate
126166

127167
This lint detects a specific situation of re-exporting a private `extern crate`;

src/doc/rustc/src/lints/listing/warn-by-default.md

-40
Original file line numberDiff line numberDiff line change
@@ -307,46 +307,6 @@ warning: path statement with no effect
307307
|
308308
```
309309

310-
## patterns-in-fns-without-body
311-
312-
This lint detects patterns in functions without body were that were
313-
previously erroneously allowed. Some example code that triggers this lint:
314-
315-
```rust
316-
trait Trait {
317-
fn foo(mut arg: u8);
318-
}
319-
```
320-
321-
This will produce:
322-
323-
```text
324-
warning: patterns aren't allowed in methods without bodies
325-
--> src/main.rs:2:12
326-
|
327-
2 | fn foo(mut arg: u8);
328-
| ^^^^^^^
329-
|
330-
= note: `#[warn(patterns_in_fns_without_body)]` on by default
331-
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
332-
= note: for more information, see issue #35203 <https://github.com/rust-lang/rust/issues/35203>
333-
```
334-
335-
To fix this, remove the pattern; it can be used in the implementation without
336-
being used in the definition. That is:
337-
338-
```rust
339-
trait Trait {
340-
fn foo(arg: u8);
341-
}
342-
343-
impl Trait for i32 {
344-
fn foo(mut arg: u8) {
345-
346-
}
347-
}
348-
```
349-
350310
## plugin-as-library
351311

352312
This lint detects when compiler plugins are used as ordinary library in

src/librustc/lint/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ declare_lint! {
189189

190190
declare_lint! {
191191
pub PATTERNS_IN_FNS_WITHOUT_BODY,
192-
Warn,
192+
Deny,
193193
"patterns in functions without body were erroneously allowed",
194194
@future_incompatible = FutureIncompatibleInfo {
195195
reference: "issue #35203 <https://github.com/rust-lang/rust/issues/35203>",

0 commit comments

Comments
 (0)