diff options
| author | bors <bors@rust-lang.org> | 2021-03-31 18:30:32 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-03-31 18:30:32 +0000 |
| commit | 487c2e8d4e543a025597f5727d99d77a72cfc7b6 (patch) | |
| tree | 5fca0ecdaf7382b1cdc39701d39e2eb6d620652c /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | 775ef473d7770f375c571004a8ca1ae42983937b (diff) | |
| parent | 21083875d211c29fcfa4a21fcd66d4601d2b618b (diff) | |
| download | rust-487c2e8d4e543a025597f5727d99d77a72cfc7b6.tar.gz rust-487c2e8d4e543a025597f5727d99d77a72cfc7b6.zip | |
Auto merge of #6913 - camsteffen:method-chain, r=flip1995
Destructure args in `methods`
changelog: none
This changes the main pattern in `methods` to match and destructure the method call args at the same time as the method name, and pass individual arg `Expr`s to the lint impls.
```rust
// before
["expect", ..] => expect::check(cx, expr, arg_lists[0]);
// after
("expect", [arg]) => expect::check(cx, expr, recv, arg);
```
This makes the code safer since there is no risk of out of bounds `args[n]` everywhere. There will be no more collecting `method_names`, `arg_lists`, `method_spans` as a separate step - everything comes out of the `match`es. Chained methods are parsed in a nested `match`. This makes the code more verbose in some ways, but IMO it is much easier to follow.
~Definitely should wait for #6896. Just putting out the idea.~
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
