Only suggest removal of `as_*` and `to_` conversion methods on E0308 by estebank · Pull Request #120473 · rust-lang/rust
Instead of
```
error[E0308]: mismatched types
--> tests/ui/suggestions/only-suggest-removal-of-conversion-method-calls.rs:9:5
|
4 | fn get_name() -> String {
| ------ expected `String` because of return type
...
9 | your_name.trim() //~ ERROR E0308
| ^^^^^^^^^^^^^^^^ expected `String`, found `&str`
|
help: try removing the method call
|
9 - your_name.trim()
9 + your_name
```
output
```
error[E0308]: mismatched types
--> $DIR/only-suggest-removal-of-conversion-method-calls.rs:9:5
|
LL | fn get_name() -> String {
| ------ expected `String` because of return type
...
LL | your_name.trim()
| ^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
| |
| expected `String`, found `&str`
```
Fix rust-lang#114329.
rustbot
added
S-waiting-on-review
labels
Jan 29, 2024
bors
added
S-waiting-on-bors
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Feb 1, 2024matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
Feb 1, 2024Only suggest removal of `as_*` and `to_` conversion methods on E0308
Instead of
```
error[E0308]: mismatched types
--> tests/ui/suggestions/only-suggest-removal-of-conversion-method-calls.rs:9:5
|
4 | fn get_name() -> String {
| ------ expected `String` because of return type
...
9 | your_name.trim()
| ^^^^^^^^^^^^^^^^ expected `String`, found `&str`
|
help: try removing the method call
|
9 - your_name.trim()
9 + your_name
```
output
```
error[E0308]: mismatched types
--> $DIR/only-suggest-removal-of-conversion-method-calls.rs:9:5
|
LL | fn get_name() -> String {
| ------ expected `String` because of return type
...
LL | your_name.trim()
| ^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
| |
| expected `String`, found `&str`
```
Fix rust-lang#114329.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request
Feb 1, 2024Only suggest removal of `as_*` and `to_` conversion methods on E0308
Instead of
```
error[E0308]: mismatched types
--> tests/ui/suggestions/only-suggest-removal-of-conversion-method-calls.rs:9:5
|
4 | fn get_name() -> String {
| ------ expected `String` because of return type
...
9 | your_name.trim()
| ^^^^^^^^^^^^^^^^ expected `String`, found `&str`
|
help: try removing the method call
|
9 - your_name.trim()
9 + your_name
```
output
```
error[E0308]: mismatched types
--> $DIR/only-suggest-removal-of-conversion-method-calls.rs:9:5
|
LL | fn get_name() -> String {
| ------ expected `String` because of return type
...
LL | your_name.trim()
| ^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
| |
| expected `String`, found `&str`
```
Fix rust-lang#114329.
bors added a commit to rust-lang-ci/rust that referenced this pull request
Feb 3, 2024…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#119759 (Add FileCheck annotations to dataflow-const-prop tests) - rust-lang#120323 (On E0277 be clearer about implicit `Sized` bounds on type params and assoc types) - rust-lang#120473 (Only suggest removal of `as_*` and `to_` conversion methods on E0308) - rust-lang#120520 (Some cleanups around diagnostic levels.) - rust-lang#120540 (add test for try-block-in-match-arm) - rust-lang#120547 (`#![feature(inline_const_pat)]` is no longer incomplete) - rust-lang#120552 (Correctly check `never_type` feature gating) - rust-lang#120555 (put pnkfelix (me) back on the review queue.) - rust-lang#120556 (Improve the diagnostics for unused generic parameters) r? `@ghost` `@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request
Feb 4, 2024…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#119759 (Add FileCheck annotations to dataflow-const-prop tests) - rust-lang#120323 (On E0277 be clearer about implicit `Sized` bounds on type params and assoc types) - rust-lang#120473 (Only suggest removal of `as_*` and `to_` conversion methods on E0308) - rust-lang#120520 (Some cleanups around diagnostic levels.) - rust-lang#120540 (add test for try-block-in-match-arm) - rust-lang#120547 (`#![feature(inline_const_pat)]` is no longer incomplete) - rust-lang#120552 (Correctly check `never_type` feature gating) - rust-lang#120555 (put pnkfelix (me) back on the review queue.) - rust-lang#120556 (Improve the diagnostics for unused generic parameters) r? `@ghost` `@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request
Feb 4, 2024…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#119759 (Add FileCheck annotations to dataflow-const-prop tests) - rust-lang#120323 (On E0277 be clearer about implicit `Sized` bounds on type params and assoc types) - rust-lang#120473 (Only suggest removal of `as_*` and `to_` conversion methods on E0308) - rust-lang#120540 (add test for try-block-in-match-arm) - rust-lang#120547 (`#![feature(inline_const_pat)]` is no longer incomplete) - rust-lang#120552 (Correctly check `never_type` feature gating) - rust-lang#120555 (put pnkfelix (me) back on the review queue.) - rust-lang#120556 (Improve the diagnostics for unused generic parameters) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Feb 5, 2024Rollup merge of rust-lang#120473 - estebank:issue-114329, r=TaKO8Ki Only suggest removal of `as_*` and `to_` conversion methods on E0308 Instead of ``` error[E0308]: mismatched types --> tests/ui/suggestions/only-suggest-removal-of-conversion-method-calls.rs:9:5 | 4 | fn get_name() -> String { | ------ expected `String` because of return type ... 9 | your_name.trim() | ^^^^^^^^^^^^^^^^ expected `String`, found `&str` | help: try removing the method call | 9 - your_name.trim() 9 + your_name ``` output ``` error[E0308]: mismatched types --> $DIR/only-suggest-removal-of-conversion-method-calls.rs:9:5 | LL | fn get_name() -> String { | ------ expected `String` because of return type ... LL | your_name.trim() | ^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_string()` | | | expected `String`, found `&str` ``` Fix rust-lang#114329.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters