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
diff --git a/lib/rs/Cargo.toml b/lib/rs/Cargo.toml
index 6c862aa..1ef524e 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 566f344..87cfbfc 100644
--- a/lib/rs/src/protocol/compact.rs
+++ b/lib/rs/src/protocol/compact.rs
@@ -84,14 +84,13 @@
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 8331d91..b447d38 100644
--- a/lib/rs/src/server/multiplexed.rs
+++ b/lib/rs/src/server/multiplexed.rs
@@ -170,8 +170,7 @@
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 b98afb8..4cd2ba9 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::{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 ea571c6..1abd07c 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 91fd027..06f65cb 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 bac37b4..5b9211c 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::{