You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[allow(dead_code)]
fn eg() {
let a = "a".to_string();
let b = "a";
if b < &a {
println!("OK");
}
}
warning: taken reference of right operand
--> src/lib.rs:6:8
|
6 | if b < &a {
| ^^^^^^
|
= note: #[warn(op_ref)] on by default
help: dereference the left operand instead
| if *b < a {
= help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#op_ref
After applying the recommendation...
#[allow(dead_code)]
fn eg() {
let a = "a".to_string();
let b = "a";
if *b < a {
println!("OK");
}
}
error[E0308]: mismatched types
--> src/lib.rs:6:13
|
6 | if *b < a {
| ^ expected str, found struct `std::string::String`
|
= note: expected type `str`
found type `std::string::String`
The text was updated successfully, but these errors were encountered:
Here is my situation:
After applying the recommendation...
The text was updated successfully, but these errors were encountered: