Repository: rust
Issue: Surprising internals in TryTrait revealed in diagnostic
Labels: A-diagnostics,T-compiler

### Code

```Rust
pub fn for_aggregator(client: Client, aggregator: Aggregator) -> Option<Self> {
        Some(Self {
            client,
            base_url: aggregator.api_url?.clone().into(),
            auth_header: HeaderValue::from(format!("Bearer {}", aggregator.bearer_token?.clone())),
            aggregator,
        })
    }
```


### Current output

```Shell
error[E0382]: use of partially moved value: `aggregator`
   --> src/clients/aggregator_client.rs:33:13
    |
32  | ...   auth_header: HeaderValue::from(format!("Bearer {}", aggregator.bearer_token?.cl...
    |                                                           ------------------------ `aggregator.bearer_token` partially moved due to this method call
33  | ...   aggregator,
    |       ^^^^^^^^^^ value used here after partial move
    |
note: `branch` takes ownership of the receiver `self`, which moves `aggregator.bearer_token`
   --> /Users/jbr/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/try_trait.rs:217:15
    |
217 |     fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;
    |               ^^^^
    = note: partial move occurs because `aggregator.bearer_token` has type `std::option::Option<std::string::String>`, which does not implement the `Copy` trait
help: you can `clone` the value and consume it, but this might not be your desired behavior
    |
32  |             auth_header: HeaderValue::from(format!("Bearer {}", clone().aggregator.bearer_token?.clone())),
    |                                                                 ++++++++

Some errors have detailed explanations: E0382, E0507.
For more information about an error, try `rustc --explain E0382`.
error: could not compile `divviup-api` (lib) due to 2 previous errors
```



### Desired output

```Shell
error[E0382]: use of partially moved value: `aggregator`
   --> src/clients/aggregator_client.rs:33:13
    |
32  | ...   auth_header: HeaderValue::from(format!("Bearer {}", aggregator.bearer_token?.cl...
    |                                                           ------------------------ `aggregator.bearer_token` partially moved due to this method call
33  | ...   aggregator,
    |       ^^^^^^^^^^ value used here after partial move
    |
    = note: partial move occurs because `aggregator.bearer_token` has type `std::option::Option<std::string::String>`, which does not implement the `Copy` trait
help: you can `clone` the value and consume it, but this might not be your desired behavior
    |
32  |             auth_header: HeaderValue::from(format!("Bearer {}", aggregator.bearer_token?.clone())),
    |                                                                                         ++++++++

Some errors have detailed explanations: E0382, E0507.
For more information about an error, try `rustc --explain E0382`.
error: could not compile `divviup-api` (lib) due to 2 previous errors
```


### Rationale and extra context

The `fn branch(self) -> ControlFlow<Self::Residual, Self::Output>` content is unhelpful as it's internal to `?`, as is the confusing and invalid suggestion of `clone().aggregator.bearer_token?.clone()`.

### Other cases

_No response_

### Anything else?

In this case, `as_deref()`/`as_ref()` was actually the preferable change to clone, but that's probably a distinct diagnostic concern