diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2021-09-15 14:56:59 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-15 14:56:59 -0700 |
| commit | 1bf94a156a387c3df6a25b5388162f8d71dd7f30 (patch) | |
| tree | ce2d6ee6ac887b0baf1dd1cc175ba4ede3082cfd /src | |
| parent | fb2d7dff806af96a127cd5338dd8a3a95cc7cbe8 (diff) | |
| parent | 8be729cdd6473859f4fb54aaf74dce56f0775ef1 (diff) | |
| download | rust-1bf94a156a387c3df6a25b5388162f8d71dd7f30.tar.gz rust-1bf94a156a387c3df6a25b5388162f8d71dd7f30.zip | |
Rollup merge of #88841 - notriddle:notriddle/method-parens, r=estebank
feat(rustc_typeck): suggest removing bad parens in `(recv.method)()` Fixes #88803
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/typeck/issue-88803-call-expr-method.fixed | 9 | ||||
| -rw-r--r-- | src/test/ui/typeck/issue-88803-call-expr-method.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/typeck/issue-88803-call-expr-method.stderr | 15 |
3 files changed, 33 insertions, 0 deletions
diff --git a/src/test/ui/typeck/issue-88803-call-expr-method.fixed b/src/test/ui/typeck/issue-88803-call-expr-method.fixed new file mode 100644 index 00000000000..19b96ecf3fc --- /dev/null +++ b/src/test/ui/typeck/issue-88803-call-expr-method.fixed @@ -0,0 +1,9 @@ +// run-rustfix + +fn main() { + let a = Some(42); + println!( + "The value is {}.", + a.unwrap() //~ERROR [E0615] + ); +} diff --git a/src/test/ui/typeck/issue-88803-call-expr-method.rs b/src/test/ui/typeck/issue-88803-call-expr-method.rs new file mode 100644 index 00000000000..a0619946637 --- /dev/null +++ b/src/test/ui/typeck/issue-88803-call-expr-method.rs @@ -0,0 +1,9 @@ +// run-rustfix + +fn main() { + let a = Some(42); + println!( + "The value is {}.", + (a.unwrap)() //~ERROR [E0615] + ); +} diff --git a/src/test/ui/typeck/issue-88803-call-expr-method.stderr b/src/test/ui/typeck/issue-88803-call-expr-method.stderr new file mode 100644 index 00000000000..dd717ed9416 --- /dev/null +++ b/src/test/ui/typeck/issue-88803-call-expr-method.stderr @@ -0,0 +1,15 @@ +error[E0615]: attempted to take value of method `unwrap` on type `Option<{integer}>` + --> $DIR/issue-88803-call-expr-method.rs:7:12 + | +LL | (a.unwrap)() + | ^^^^^^ method, not a field + | +help: remove wrapping parentheses to call the method + | +LL - (a.unwrap)() +LL + a.unwrap() + | + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0615`. |
