summaryrefslogtreecommitdiff
path: root/tutorial
diff options
context:
space:
mode:
authorAllen George <allengeorge@apache.org>2021-03-06 14:11:56 -0500
committerGitHub <noreply@github.com>2021-03-06 14:11:56 -0500
commit99c3aa27e6f6daa062b905a65495315c0c2ded90 (patch)
tree91ee1c0185dea778b19b48a0849926e419c8bde4 /tutorial
parenta8c041dd580ff37f3e32b0eaafed542f496d5d58 (diff)
downloadthrift-99c3aa27e6f6daa062b905a65495315c0c2ded90.tar.gz
Enable clippy in all Rust targets and ensure that all existing code is clippy-clean (#2341)
Client: rs
Diffstat (limited to 'tutorial')
-rw-r--r--tutorial/rs/Makefile.am1
-rw-r--r--tutorial/rs/src/bin/tutorial_server.rs10
2 files changed, 6 insertions, 5 deletions
diff --git a/tutorial/rs/Makefile.am b/tutorial/rs/Makefile.am
index 4aa05dada..13f670794 100644
--- a/tutorial/rs/Makefile.am
+++ b/tutorial/rs/Makefile.am
@@ -25,6 +25,7 @@ gen-rs/tutorial.rs gen-rs/shared.rs: $(top_srcdir)/tutorial/tutorial.thrift
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 ad16ab6dc..ab6df57fb 100644
--- a/tutorial/rs/src/bin/tutorial_server.rs
+++ b/tutorial/rs/src/bin/tutorial_server.rs
@@ -131,11 +131,11 @@ impl CalculatorSyncHandler for CalculatorServer {
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()),