2020-08-16 20:33:30 -05:00
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> $DIR/chain-method-call-mutation-in-place.rs:3:5
|
|
|
|
|
|
|
|
|
LL | fn foo(mut s: String) -> String {
|
2020-09-02 02:40:56 -05:00
|
|
|
| ------ expected `String` because of return type
|
2020-08-16 20:33:30 -05:00
|
|
|
LL | s.push_str("asdf")
|
2023-01-02 20:00:33 -06:00
|
|
|
| ^^^^^^^^^^^^^^^^^^ expected `String`, found `()`
|
2020-08-16 20:33:30 -05:00
|
|
|
|
|
|
|
|
note: method `push_str` modifies its receiver in-place
|
|
|
|
--> $DIR/chain-method-call-mutation-in-place.rs:3:7
|
|
|
|
|
|
|
|
|
LL | s.push_str("asdf")
|
|
|
|
| - ^^^^^^^^ this call modifies `s` in-place
|
|
|
|
| |
|
|
|
|
| you probably want to use this value after calling the method...
|
|
|
|
= note: ...instead of the `()` output of method `push_str`
|
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|