Skip to content

Commit 073c03b

Browse files
committed
path-lookahead
1 parent 20b49f8 commit 073c03b

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

tests/ui/parser/ufcs-return-unused-parens.fixed

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
//! Check that UFCS syntax works correctly in return statements without requiring workaround parentheses.
2+
//!
3+
//! Regression test for <https://github.com/rust-lang/rust/issues/37765>.
4+
15
//@ run-pass
26
//@ run-rustfix
37

48
#![allow(dead_code)]
59
#![warn(unused_parens)]
610

7-
// Parser test for #37765
8-
911
fn with_parens<T: ToString>(arg: T) -> String {
10-
return <T as ToString>::to_string(&arg); //~WARN unnecessary parentheses around `return` value
12+
return <T as ToString>::to_string(&arg); //~ WARN unnecessary parentheses around `return` value
1113
}
1214

1315
fn no_parens<T: ToString>(arg: T) -> String {

tests/ui/parser/ufcs-return-unused-parens.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1+
//! Check that UFCS syntax works correctly in return statements
2+
//! without requiring workaround parentheses.
3+
//!
4+
//! Regression test for <https://github.com/rust-lang/rust/issues/37765>.
5+
16
//@ run-pass
27
//@ run-rustfix
38

49
#![allow(dead_code)]
510
#![warn(unused_parens)]
611

7-
// Parser test for #37765
8-
912
fn with_parens<T: ToString>(arg: T) -> String {
10-
return (<T as ToString>::to_string(&arg)); //~WARN unnecessary parentheses around `return` value
13+
return (<T as ToString>::to_string(&arg)); //~ WARN unnecessary parentheses around `return` value
1114
}
1215

1316
fn no_parens<T: ToString>(arg: T) -> String {

tests/ui/parser/ufcs-return-unused-parens.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
warning: unnecessary parentheses around `return` value
2-
--> $DIR/path-lookahead.rs:10:12
2+
--> $DIR/ufcs-return-unused-parens.rs:12:12
33
|
44
LL | return (<T as ToString>::to_string(&arg));
55
| ^ ^
66
|
77
note: the lint level is defined here
8-
--> $DIR/path-lookahead.rs:5:9
8+
--> $DIR/ufcs-return-unused-parens.rs:9:9
99
|
1010
LL | #![warn(unused_parens)]
1111
| ^^^^^^^^^^^^^

0 commit comments

Comments
 (0)