Given the following
fn main() {
function(false);
}
fn function(_param: String) {
}
fn return_value(value: f64) -> f64 {
5.
}
If I check it with cargo check --message-format short
, I get
src/main.rs:2:14: error[E0308]: mismatched types
src/main.rs:9:17: warning: unused variable: `value`
With cargo check --message-format human
error[E0308]: mismatched types
--> src/main.rs:2:14
|
2 | function(false);
| -------- ^^^^^- help: try using a conversion method: `.to_string()`
| | |
| | expected `String`, found `bool`
| arguments to this function are incorrect
|
note: function defined here
--> src/main.rs:5:4
|
5 | fn function(_param: String) {
| ^^^^^^^^ --------------
warning: unused variable: `value`
--> src/main.rs:9:17
|
9 | fn return_value(value: f64) -> f64 {
| ^^^^^ help: if this is intentional, prefix it with an underscore: `_value`
|
= note: `#[warn(unused_variables)]` on by default
I like the --message-format short
because it can be easier to read errors when there are lots of them. Unfortunately the src/main.rs:2:28: error[E0308]: mismatched types
doesn't have enough information to make an action. The unused variable: 'value'
warning is good because it tells that value
is unused. It would be nice if the src/main.rs:2:14: error[E0308]: mismatched types
had the same sort of information in the diagnostic title.
src/main.rs:2:14: error[E0308]: mismatched types: false not assignable to String
would be much better