From 6390e758d4726bbaf09eda2fc8efba49ee34ad81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Wed, 13 Jan 2021 14:42:49 +0100 Subject: [PATCH] fix clippy in all examples. added a ignore for plugins, as we cannot remove the `Result<>` type, it is necessary --- network/examples/fileshare/server.rs | 1 + plugin/derive/src/lib.rs | 1 + world/examples/water.rs | 12 ++++-------- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/network/examples/fileshare/server.rs b/network/examples/fileshare/server.rs index 33ceda100f..080b85fff5 100644 --- a/network/examples/fileshare/server.rs +++ b/network/examples/fileshare/server.rs @@ -117,6 +117,7 @@ impl Server { trace!("Stop connect_manager"); } + #[allow(clippy::eval_order_dependence)] async fn loop_participant(&self, p: Participant) { if let (Ok(cmd_out), Ok(file_out), Ok(cmd_in), Ok(file_in)) = ( p.open(15, Promises::ORDERED | Promises::CONSISTENCY).await, diff --git a/plugin/derive/src/lib.rs b/plugin/derive/src/lib.rs index 860c98179a..77ee375937 100644 --- a/plugin/derive/src/lib.rs +++ b/plugin/derive/src/lib.rs @@ -14,6 +14,7 @@ pub fn event_handler(_args: TokenStream, item: TokenStream) -> TokenStream { let fn_return = sig.output; // comma separated args let out: proc_macro2::TokenStream = quote! { + #[allow(clippy::unnecessary_wraps)] #[no_mangle] pub fn #fn_name(intern__ptr: i32, intern__len: u32) -> i32 { let input = ::veloren_plugin_rt::read_input(intern__ptr,intern__len).unwrap(); diff --git a/world/examples/water.rs b/world/examples/water.rs index 0434bc9eaa..0188148d6b 100644 --- a/world/examples/water.rs +++ b/world/examples/water.rs @@ -375,20 +375,16 @@ fn main() { if is_camera { focus.z += spd * scale; samples_changed = true; - } else { - if (scale * 2.0).is_normal() { - scale *= 2.0; - } + } else if (scale * 2.0).is_normal() { + scale *= 2.0; } } if win.is_key_down(minifb::Key::F) { if is_camera { focus.z -= spd * scale; samples_changed = true; - } else { - if (scale / 2.0).is_normal() { - scale /= 2.0; - } + } else if (scale / 2.0).is_normal() { + scale /= 2.0; } }