summaryrefslogtreecommitdiff
path: root/lib/rs
diff options
context:
space:
mode:
authorTdxdxoz <tdxdxoz@gmail.com>2022-07-17 14:14:12 +0200
committerJens Geyer <jensg@apache.org>2022-09-01 22:05:45 +0200
commit85d82bfd0c244d88fb01a1e761606d78868dc49c (patch)
tree286391a5fc28f2d9cfc31ef80137682fbe091b25 /lib/rs
parent7815d645045b62ca74f6caabbb4cd2b60c33a6c4 (diff)
downloadthrift-85d82bfd0c244d88fb01a1e761606d78868dc49c.tar.gz
THRIFT-5600: upgrade rust toolchain to 1.61 and edition 2021
THRIFT-5606: Wrong indent for const double Client: rs Patch: Ommy Zhang <tdxdxoz@gmail.com> This closes #2634
Diffstat (limited to 'lib/rs')
-rw-r--r--lib/rs/Cargo.toml2
-rw-r--r--lib/rs/src/protocol/compact.rs9
-rw-r--r--lib/rs/src/server/multiplexed.rs3
-rw-r--r--lib/rs/test/src/bin/kitchen_sink_client.rs1
-rw-r--r--lib/rs/test/src/bin/kitchen_sink_server.rs1
-rw-r--r--lib/rs/test/src/lib.rs2
-rw-r--r--lib/rs/test_recursive/src/lib.rs2
7 files changed, 8 insertions, 12 deletions
diff --git a/lib/rs/Cargo.toml b/lib/rs/Cargo.toml
index 6c862aaf3..1ef524e2a 100644
--- a/lib/rs/Cargo.toml
+++ b/lib/rs/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "thrift"
description = "Rust bindings for the Apache Thrift RPC system"
-edition = "2018"
+edition = "2021"
version = "0.18.0"
license = "Apache-2.0"
authors = ["Apache Thrift Developers <dev@thrift.apache.org>"]
diff --git a/lib/rs/src/protocol/compact.rs b/lib/rs/src/protocol/compact.rs
index 566f344cf..87cfbfc46 100644
--- a/lib/rs/src/protocol/compact.rs
+++ b/lib/rs/src/protocol/compact.rs
@@ -84,14 +84,13 @@ where
let header = self.read_byte()?;
let element_type = collection_u8_to_type(header & 0x0F)?;
- let element_count;
let possible_element_count = (header & 0xF0) >> 4;
- if possible_element_count != 15 {
+ let element_count = if possible_element_count != 15 {
// high bits set high if count and type encoded separately
- element_count = possible_element_count as i32;
+ possible_element_count as i32
} else {
- element_count = self.transport.read_varint::<u32>()? as i32;
- }
+ self.transport.read_varint::<u32>()? as i32
+ };
Ok((element_type, element_count))
}
diff --git a/lib/rs/src/server/multiplexed.rs b/lib/rs/src/server/multiplexed.rs
index 8331d91ef..b447d387e 100644
--- a/lib/rs/src/server/multiplexed.rs
+++ b/lib/rs/src/server/multiplexed.rs
@@ -170,8 +170,7 @@ fn split_ident_name(ident_name: &str) -> (Option<&str>, &str) {
let (_, svc_call) = svc_call.split_at(1); // remove colon from service call name
(Some(svc_name), svc_call)
})
- .or_else(|| Some((None, ident_name)))
- .unwrap()
+ .unwrap_or((None, ident_name))
}
fn missing_processor_message(svc_name: Option<&str>) -> String {
diff --git a/lib/rs/test/src/bin/kitchen_sink_client.rs b/lib/rs/test/src/bin/kitchen_sink_client.rs
index b98afb814..4cd2ba9bf 100644
--- a/lib/rs/test/src/bin/kitchen_sink_client.rs
+++ b/lib/rs/test/src/bin/kitchen_sink_client.rs
@@ -33,7 +33,6 @@ use kitchen_sink::recursive;
use kitchen_sink::recursive::{CoRec, CoRec2, RecList, RecTree, TTestServiceSyncClient};
use kitchen_sink::ultimate::{FullMealServiceSyncClient, TFullMealServiceSyncClient};
-use thrift;
use thrift::protocol::{
TBinaryInputProtocol, TBinaryOutputProtocol, TCompactInputProtocol, TCompactOutputProtocol,
TInputProtocol, TOutputProtocol,
diff --git a/lib/rs/test/src/bin/kitchen_sink_server.rs b/lib/rs/test/src/bin/kitchen_sink_server.rs
index ea571c686..1abd07c66 100644
--- a/lib/rs/test/src/bin/kitchen_sink_server.rs
+++ b/lib/rs/test/src/bin/kitchen_sink_server.rs
@@ -18,7 +18,6 @@
use clap::{clap_app, value_t};
use log::*;
-use thrift;
use thrift::protocol::{
TBinaryInputProtocolFactory, TBinaryOutputProtocolFactory, TCompactInputProtocolFactory,
TCompactOutputProtocolFactory, TInputProtocolFactory, TOutputProtocolFactory,
diff --git a/lib/rs/test/src/lib.rs b/lib/rs/test/src/lib.rs
index 91fd02728..06f65cbc3 100644
--- a/lib/rs/test/src/lib.rs
+++ b/lib/rs/test/src/lib.rs
@@ -18,8 +18,8 @@
pub mod base_one;
pub mod base_two;
pub mod midlayer;
-pub mod ultimate;
pub mod recursive;
+pub mod ultimate;
#[cfg(test)]
mod tests {
diff --git a/lib/rs/test_recursive/src/lib.rs b/lib/rs/test_recursive/src/lib.rs
index bac37b4de..5b9211c41 100644
--- a/lib/rs/test_recursive/src/lib.rs
+++ b/lib/rs/test_recursive/src/lib.rs
@@ -17,9 +17,9 @@
#![allow(dead_code)]
+pub mod maintenance;
pub mod transit;
pub mod vehicles;
-pub mod maintenance;
mod server {
use crate::maintenance::maintenance_facility::{