[warn(unused_variables)]` on by default help: if this is intentional, prefix it with an underscore | 39 | MyError::DBError(_msg) | MyError::ActixError(_msg) => StatusCode::INTERNAL_SERVER_ERROR, | ~~~ ~~~ warning: unused variable: `msg` --> webservice/src/bin/../errors.rs:...
= note: `#[warn(unused_variables)]` on by default warning: unused variable: `y` --> src/main.rs:3:12 | 3 | let (x,y,z,w) = tup; | ^ help: if this is intentional, prefix it with an underscore: `_y` warning: unused variable: `z` --> src/main.rs:3:14 | ...
使用--release构建此代码将发出警告: warning: unused variable: `before` --> src/lib.rs:13:9 | 13 | let before = thing.clone(); | ^^^ help: if this is intentional, prefix it with an underscore: `_before` | = note: `#[warn(unused_variables)]` on by default...
// An attribute to hide warnings for unused code. #![allow(dead_code)] 试着按提示加了#[warn(not(unused_variables))],报错: error[E0452]: malformed lint attribute input --> src/main.rs:3:8 | 3 | #[warn(not(unused_variables))] | ^^^ bad attribute argument 难道画蛇添足了?去掉no...
warning: unused variable: `s2` --> src/main.rs:4:9 | 4 | let s2 = s1; | ^^ help: if this is intentional, prefix it with an underscore: `_s2` | = note: `#[warn(unused_variables)]` on by default warning: `greeting` (bin "greeting") generated 1 warning (run `cargo fix ...
= note: `#[warn(unused_variables)]` on bydefault 有用的是,它告诉我们如何修复它:我们可以显式忽略 name 字段: fn city_name(user: &User) -> String { let User {city, country, name: _} = user; format!("{}, {}", city, country) ...
warning: unused variable:`aside`-->src/main.rs:4:9|4|letaside=v;|^^^ help:ifthis is intentional, prefix it with an underscore:`_aside`|=note:`#[warn(unused_variables)]`on by default error[E0505]: cannot move out of`v`because it is borrowed --...
Compiling playground v0.0.1 (/playground)warning: unused variable: `x` --> src/main.rs:2:9 |2 | let x = 4; | ^ help: if this is intentional, prefix it with an underscore: `_x` | = note: `#[warn(unused_variables)]` on by defaultwarning: `playground` (bin "pl...
= note: `#[warn(unused_variables)]` on by default error[E0382]: borrow of moved value: `b` --> src\main.rs:7:22 | 3 | let b = Box::new(2); | - move occurs because `b` has type `Box<i32>`, which does not implement the `Copy` trait 4 | 5 | let c = Point { ...
warning:unused variable:`y`-->ownership.rs:3:9|3|lety=x;|^help:ifthisis intentional,prefix itwithan underscore:`_y`|=note:`#[warn(unused_variables)]`on bydefaulterror[E0382]:borrowofmoved value:`x`-->ownership.rs:4:23|2|letx=String::from("hello");|-move occurs because`x`has ...