2020-08-17 01:33:30 +00: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 07:40:56 +00:00
|
|
|
| ------ expected `String` because of return type
|
2020-08-17 01:33:30 +00:00
|
|
|
LL | s.push_str("asdf")
|
2020-09-02 07:40:56 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^ expected struct `String`, found `()`
|
2020-08-17 01:33:30 +00: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`.
|