]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/chain-method-call-mutation-in-place.stderr
Rollup merge of #107389 - zvavybir:master, r=estebank
[rust.git] / tests / ui / suggestions / chain-method-call-mutation-in-place.stderr
1 error[E0308]: mismatched types
2   --> $DIR/chain-method-call-mutation-in-place.rs:3:5
3    |
4 LL | fn foo(mut s: String) -> String {
5    |                          ------ expected `String` because of return type
6 LL |     s.push_str("asdf")
7    |     ^^^^^^^^^^^^^^^^^^ expected `String`, found `()`
8    |
9 note: method `push_str` modifies its receiver in-place
10   --> $DIR/chain-method-call-mutation-in-place.rs:3:7
11    |
12 LL |     s.push_str("asdf")
13    |     - ^^^^^^^^ this call modifies `s` in-place
14    |     |
15    |     you probably want to use this value after calling the method...
16    = note: ...instead of the `()` output of method `push_str`
17
18 error: aborting due to previous error
19
20 For more information about this error, try `rustc --explain E0308`.