IMI-eRnD-Be / wasm-run

Bundles and tooling for Rust WASM frontend application
MIT License
35 stars 3 forks source link

Clippy error #27

Open yozhgoor opened 3 years ago

yozhgoor commented 3 years ago

Clippy tell me that i have an error with my pre_build function, an unnecessary wraps as the Result in the return type signature

fn pre_build(_args: &DefaultBuildArgs, profile: BuildProfile, command: &mut Command) -> Result<()> {
    match profile {
        BuildProfile::Profiling | BuildProfile::Release => {
            command.args(&["--features", "wee_alloc"]);
        }
        BuildProfile::Dev => {
            command.args(&["--features", "console_error_panic_hook"]);
        }
    }

    Ok(())
}

My program compile, i just don't pass clippy checks

yozhgoor commented 3 years ago

Clippy give me this:

this function's return value is unnecessarily wrapped by Result


error: this function's return value is unnecessarily wrapped by `Result`
--> frontend/src/main.rs:10:1
|
10 | / fn pre_build(_args: &DefaultBuildArgs, profile: BuildProfile, command: &mut Command) -> Result<()> {
11 | |     match profile {
12 | |         BuildProfile::Profiling | BuildProfile::Release => {
13 | |             command.args(&["--features", "wee_alloc"]);
...  |
20 | |     Ok(())
21 | | }
| |_^
|
= note: `-D clippy::unnecessary-wraps` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps
help: remove `Result` from the return type...
|
10 | fn pre_build(_args: &DefaultBuildArgs, profile: BuildProfile, command: &mut Command) -> () {
|                                                                                         ^^
help: ...and change the returning expressions
|
20 |     ()
|
cecton commented 3 years ago

Related to https://github.com/rust-lang/rust-clippy/issues/6427

cecton commented 3 years ago

This is now in stable.

https://github.com/rust-lang/rust-clippy/issues/6427#issuecomment-777640040

Can you check that it works?

yozhgoor commented 3 years ago

I have made some test, don't see changes. Maybe a release to come ?

cecton commented 3 years ago

I have made some test, don't see changes. Maybe a release to come ?

I tested and it also failed to me. I have no idea... I will ask don't worry

yozhgoor commented 3 years ago

A merge have been done 16hours ago (https://github.com/rust-lang/rust-clippy/pull/6765) Have give a try with a cargo update but I not see so much change