Enable clippy in all Rust targets and ensure that all existing code is clippy-clean (#2341)
Client: rs
diff --git a/tutorial/rs/Makefile.am b/tutorial/rs/Makefile.am
index 4aa05da..13f6707 100644
--- a/tutorial/rs/Makefile.am
+++ b/tutorial/rs/Makefile.am
@@ -25,6 +25,7 @@
all-local: gen-rs/tutorial.rs
$(CARGO) build
$(CARGO) fmt --all -- --check
+ $(CARGO) clippy --all -- -D warnings
[ -d bin ] || mkdir bin
cp target/debug/tutorial_server bin/tutorial_server
cp target/debug/tutorial_client bin/tutorial_client
diff --git a/tutorial/rs/src/bin/tutorial_server.rs b/tutorial/rs/src/bin/tutorial_server.rs
index ad16ab6..ab6df57 100644
--- a/tutorial/rs/src/bin/tutorial_server.rs
+++ b/tutorial/rs/src/bin/tutorial_server.rs
@@ -131,11 +131,11 @@
let num1 = w.num1.as_ref().expect("operands checked");
let num2 = w.num2.as_ref().expect("operands checked");
- match op {
- &Operation::ADD => Ok(num1 + num2),
- &Operation::SUBTRACT => Ok(num1 - num2),
- &Operation::MULTIPLY => Ok(num1 * num2),
- &Operation::DIVIDE => {
+ match *op {
+ Operation::ADD => Ok(num1 + num2),
+ Operation::SUBTRACT => Ok(num1 - num2),
+ Operation::MULTIPLY => Ok(num1 * num2),
+ Operation::DIVIDE => {
if *num2 == 0 {
Err(InvalidOperation {
what_op: Some(op.into()),