File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change
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
+
1
5
//@ run-pass
2
6
//@ run-rustfix
3
7
4
8
#![allow(dead_code)]
5
9
#![warn(unused_parens)]
6
10
7
- // Parser test for #37765
8
-
9
11
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
11
13
}
12
14
13
15
fn no_parens<T: ToString>(arg: T) -> String {
Original file line number Diff line number Diff line change
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
+
1
6
//@ run-pass
2
7
//@ run-rustfix
3
8
4
9
#![ allow( dead_code) ]
5
10
#![ warn( unused_parens) ]
6
11
7
- // Parser test for #37765
8
-
9
12
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
11
14
}
12
15
13
16
fn no_parens < T : ToString > ( arg : T ) -> String {
Original file line number Diff line number Diff line change 1
1
warning: unnecessary parentheses around `return` value
2
- --> $DIR/path-lookahead .rs:10 :12
2
+ --> $DIR/ufcs-return-unused-parens .rs:12 :12
3
3
|
4
4
LL | return (<T as ToString>::to_string(&arg));
5
5
| ^ ^
6
6
|
7
7
note: the lint level is defined here
8
- --> $DIR/path-lookahead .rs:5 :9
8
+ --> $DIR/ufcs-return-unused-parens .rs:9 :9
9
9
|
10
10
LL | #![warn(unused_parens)]
11
11
| ^^^^^^^^^^^^^
You can’t perform that action at this time.
0 commit comments