about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/common.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2025-07-23 19:23:43 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-07-23 19:23:49 +0000
commit78fc7c351db02f29d0d4fbdf9025898225e32939 (patch)
treeca0d7f91cee91019f8ce3af3823583bfc004df4b /compiler/rustc_codegen_llvm/src/common.rs
parentee3a0783df39cb11c5706e38805eb9258b4fad79 (diff)
downloadrust-78fc7c351db02f29d0d4fbdf9025898225e32939.tar.gz
rust-78fc7c351db02f29d0d4fbdf9025898225e32939.zip
Suggest unwrapping when private method name is available in inner type
Given

```rust
fn main() {
    let maybe_vec = Some(vec![1,2,3]);
    assert_eq!(maybe_vec.len(), 3);
}
```

suggest unwraping `maybe_vec` to call `.len()` on the `Vec<_>`.

```
error[E0624]: method `len` is private
  --> $DIR/enum-method-probe.rs:61:9
   |
LL |     res.len();
   |         ^^^ private method
  --> $SRC_DIR/core/src/option.rs:LL:COL
   |
   = note: private method defined here
   |
note: the method `len` exists on the type `Vec<{integer}>`
  --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
help: consider using `Option::expect` to unwrap the `Vec<{integer}>` value, panicking if the value is an `Option::None`
   |
LL |     res.expect("REASON").len();
   |        +++++++++++++++++
```
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/common.rs')
0 files changed, 0 insertions, 0 deletions