diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 1189cd53def..4566f08c772 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -713,7 +713,7 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 60
env:
- TOOLCHAIN_VERSION: 1.85.1
+ TOOLCHAIN_VERSION: 1.99.0
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
diff --git a/.github/workflows/release_rust.yml b/.github/workflows/release_rust.yml
index ea94b2a30e5..f42e4a87a52 100644
--- a/.github/workflows/release_rust.yml
+++ b/.github/workflows/release_rust.yml
@@ -39,17 +39,14 @@ jobs:
with:
persist-credentials: false
- - name: Install Rust 1.85
- # The repo-pinned toolchain (rust-toolchain: 1.83) predates edition2024 support
- # required by transitive dependencies (getrandom >= 0.4); 1.85 is the minimum
- # that passes. Pin explicitly for reproducibility.
- run: rustup toolchain install 1.85 --profile minimal
+ - name: Install Rust 1.99.0
+ run: rustup toolchain install 1.99.0 --profile minimal
- name: Dry run
working-directory: lib/rs
run: cargo publish --dry-run
env:
- RUSTUP_TOOLCHAIN: "1.85"
+ RUSTUP_TOOLCHAIN: "1.99.0"
publish:
runs-on: ubuntu-latest
@@ -75,8 +72,8 @@ jobs:
fi
echo "Version check passed: $CRATE_VERSION"
- - name: Install Rust 1.85
- run: rustup toolchain install 1.85 --profile minimal
+ - name: Install Rust 1.99.0
+ run: rustup toolchain install 1.99.0 --profile minimal
- name: Authenticate to crates.io
id: crates-io-auth
@@ -86,5 +83,5 @@ jobs:
working-directory: lib/rs
run: cargo publish
env:
- RUSTUP_TOOLCHAIN: "1.85"
+ RUSTUP_TOOLCHAIN: "1.99.0"
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
diff --git a/LANGUAGES.md b/LANGUAGES.md
index 35cc9f51060..56b8aa9cfa2 100644
--- a/LANGUAGES.md
+++ b/LANGUAGES.md
@@ -357,7 +357,7 @@ language; it is the effective minimum the project stands behind for that release
Rust |
0.11.0 |
 |  |
-1.83.0 | 1.85.1 |
+1.85.0 | 1.99.0 |
 |
 |  |  |  |  |  |
 |  |  |  |
diff --git a/build/docker/README.md b/build/docker/README.md
index cedfd9423fa..b8b4058078f 100644
--- a/build/docker/README.md
+++ b/build/docker/README.md
@@ -193,5 +193,5 @@ Last updated: May 2, 2026
| php | 8.2 (ondrej) | 8.3 | jammy pulls 8.2 from ppa:ondrej/php |
| python3 | 3.10.12 | | |
| ruby | 3.0.2p107 | | |
-| rust | 1.83.0 | | |
+| rust | 1.99.0 | | |
| smalltalk | | | Not in CI |
diff --git a/build/docker/ubuntu-jammy/Dockerfile b/build/docker/ubuntu-jammy/Dockerfile
index 7cf8777c782..66664417cfe 100644
--- a/build/docker/ubuntu-jammy/Dockerfile
+++ b/build/docker/ubuntu-jammy/Dockerfile
@@ -260,7 +260,7 @@ RUN apt-get install -y --no-install-recommends \
USER ${user}
RUN `# Rust dependencies` \
- curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.83.0 -y
+ curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.99.0 -y
ENV PATH=/home/${user}/.cargo/bin:$PATH
USER root
diff --git a/build/docker/ubuntu-noble/Dockerfile b/build/docker/ubuntu-noble/Dockerfile
index 2b1189b378b..369554d8efd 100644
--- a/build/docker/ubuntu-noble/Dockerfile
+++ b/build/docker/ubuntu-noble/Dockerfile
@@ -258,7 +258,7 @@ RUN apt-get install -y --no-install-recommends \
USER ${user}
RUN `# Rust dependencies` \
- curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.83.0 -y
+ curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain 1.99.0 -y
ENV PATH=/home/${user}/.cargo/bin:$PATH
USER root
diff --git a/compiler/cpp/src/thrift/generate/t_rs_generator.cc b/compiler/cpp/src/thrift/generate/t_rs_generator.cc
index 02ee1e9e8b3..88073488fc5 100644
--- a/compiler/cpp/src/thrift/generate/t_rs_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_rs_generator.cc
@@ -1302,10 +1302,9 @@ void t_rs_generator::render_result_struct_to_result_method(t_struct* tstruct) {
string field_name("self." + rust_field_name(tfield));
string branch_statement = rendered_branch_count == 0 ? "if" : "} else if";
- f_gen_ << indent() << branch_statement << " " << field_name << ".is_some() {" << '\n';
+ f_gen_ << indent() << branch_statement << " let Some(e) = " << field_name << " {" << '\n';
indent_up();
- f_gen_ << indent() << "Err(thrift::Error::User(Box::new(" << field_name << ".unwrap())))"
- << '\n';
+ f_gen_ << indent() << "Err(thrift::Error::User(Box::new(e)))" << '\n';
indent_down();
rendered_branch_count++;
@@ -1329,10 +1328,10 @@ void t_rs_generator::render_result_struct_to_result_method(t_struct* tstruct) {
}
} else {
string branch_statement = rendered_branch_count == 0 ? "if" : "} else if";
- f_gen_ << indent() << branch_statement << " self." << SERVICE_RESULT_VARIABLE << ".is_some() {"
- << '\n';
+ f_gen_ << indent() << branch_statement << " let Some(r) = self." << SERVICE_RESULT_VARIABLE
+ << " {" << '\n';
indent_up();
- f_gen_ << indent() << "Ok(self." << SERVICE_RESULT_VARIABLE << ".unwrap())" << '\n';
+ f_gen_ << indent() << "Ok(r)" << '\n';
indent_down();
f_gen_ << indent() << "} else {" << '\n';
indent_up();
diff --git a/configure.ac b/configure.ac
index f94c91d9f8d..8dc5f48b80b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -446,7 +446,7 @@ if test "$with_rs" = "yes"; then
AC_PATH_PROG([CARGO], [cargo])
AC_PATH_PROG([RUSTC], [rustc])
if [[ -x "$CARGO" ]] && [[ -x "$RUSTC" ]]; then
- min_rustc_version="1.13"
+ min_rustc_version="1.85"
AC_MSG_CHECKING([for rustc version])
rustc_version=`$RUSTC --version 2>&1 | $SED -n -e 's/^rustc \(@<:@0-9@:>@@<:@0-9.@:>@*\).*/\1/p'`
diff --git a/doc/thrift-threat-model.md b/doc/thrift-threat-model.md
index 9b30ca13b03..a2f7498cc85 100644
--- a/doc/thrift-threat-model.md
+++ b/doc/thrift-threat-model.md
@@ -187,7 +187,7 @@ Thrift is a polyglot library; "the environment" varies per binding. Common assum
### Rust runtime (`lib/rs/`)
-- **Rust 1.65+ since 0.14.0** *(documented — `lib/rs/README.md` §Thrift 0.14.0 / THRIFT-5158)*.
+- **Rust 1.85+ since 0.26.0** *(documented — `lib/rs/README.md` §Thrift 0.26.0 / THRIFT-6162)*.
- **Past CVE-class:** THRIFT-5812 (capacity overflow in Rust server).
### What Thrift does *not* do to its host
diff --git a/lib/rs/Cargo.toml b/lib/rs/Cargo.toml
index e8e8c1d1235..c1fcf51bc56 100644
--- a/lib/rs/Cargo.toml
+++ b/lib/rs/Cargo.toml
@@ -1,7 +1,8 @@
[package]
name = "thrift"
description = "Rust bindings for the Apache Thrift RPC system"
-edition = "2021"
+edition = "2024"
+rust-version = "1.85"
version = "0.26.0"
license = "Apache-2.0"
authors = ["Apache Thrift Developers "]
diff --git a/lib/rs/README.md b/lib/rs/README.md
index 211b6eb8ecf..bf2d0d596c6 100644
--- a/lib/rs/README.md
+++ b/lib/rs/README.md
@@ -56,15 +56,19 @@ Full [Rustdoc](https://docs.rs/thrift/)
## Compatibility
-The Rust library and auto-generated code target Rust versions 1.65+. The
-minimum was raised from Rust 1.28 by THRIFT-5158, when the library and generator
-moved to Rust 2021-only output. Enabling the optional `rustls` feature requires
-Rust 1.71+.
+The Rust library uses the Rust 2024 edition and requires Rust 1.85+, the
+`rust-version` declared in `Cargo.toml`. CI builds and tests with the Rust
+release pinned in the repository's `rust-toolchain` file.
### Breaking Changes
Breaking changes are minimized. When they are made they will be outlined below with transition guidelines.
+##### Thrift 0.26.0
+
+* **[THRIFT-6162]** - The library moved to the Rust 2024 edition and requires Rust 1.85 or higher.
+ Previously the documented minimum was Rust 1.65 (1.71 with the `rustls` feature).
+
##### Thrift 0.15.0
* **[THRIFT-5360]** - No longer define OR generate `description()` methods for `Error` types.
diff --git a/lib/rs/src/protocol/binary.rs b/lib/rs/src/protocol/binary.rs
index 550acd63300..a65c6d165aa 100644
--- a/lib/rs/src/protocol/binary.rs
+++ b/lib/rs/src/protocol/binary.rs
@@ -468,7 +468,7 @@ where
kind: ProtocolErrorKind::Unknown,
message: format!(
"cannot write identifier {:?} without sequence number",
- &identifier
+ identifier
),
}));
}
@@ -820,9 +820,11 @@ mod tests {
fn must_write_field_begin() {
let (_, mut o_prot) = test_objects(true);
- assert!(o_prot
- .write_field_begin(&TFieldIdentifier::new("some_field", TType::String, 22))
- .is_ok());
+ assert!(
+ o_prot
+ .write_field_begin(&TFieldIdentifier::new("some_field", TType::String, 22))
+ .is_ok()
+ );
let expected: [u8; 3] = [0x0B, 0x00, 0x16];
assert_eq_written_bytes!(o_prot, expected);
@@ -883,9 +885,11 @@ mod tests {
fn must_write_list_begin() {
let (_, mut o_prot) = test_objects(true);
- assert!(o_prot
- .write_list_begin(&TListIdentifier::new(TType::Bool, 5))
- .is_ok());
+ assert!(
+ o_prot
+ .write_list_begin(&TListIdentifier::new(TType::Bool, 5))
+ .is_ok()
+ );
let expected: [u8; 5] = [0x02, 0x00, 0x00, 0x00, 0x05];
assert_eq_written_bytes!(o_prot, expected);
@@ -926,9 +930,11 @@ mod tests {
fn must_write_set_begin() {
let (_, mut o_prot) = test_objects(true);
- assert!(o_prot
- .write_set_begin(&TSetIdentifier::new(TType::I16, 7))
- .is_ok());
+ assert!(
+ o_prot
+ .write_set_begin(&TSetIdentifier::new(TType::I16, 7))
+ .is_ok()
+ );
let expected: [u8; 5] = [0x06, 0x00, 0x00, 0x00, 0x07];
assert_eq_written_bytes!(o_prot, expected);
@@ -968,9 +974,11 @@ mod tests {
fn must_write_map_begin() {
let (_, mut o_prot) = test_objects(true);
- assert!(o_prot
- .write_map_begin(&TMapIdentifier::new(TType::I64, TType::Struct, 32))
- .is_ok());
+ assert!(
+ o_prot
+ .write_map_begin(&TMapIdentifier::new(TType::I64, TType::Struct, 32))
+ .is_ok()
+ );
let expected: [u8; 6] = [0x0A, 0x0C, 0x00, 0x00, 0x00, 0x20];
assert_eq_written_bytes!(o_prot, expected);
@@ -1250,9 +1258,10 @@ mod tests {
match result {
Err(crate::Error::Protocol(e)) => {
assert_eq!(e.kind, ProtocolErrorKind::SizeLimit);
- assert!(e
- .message
- .contains("Container size 200 exceeds maximum allowed size of 100"));
+ assert!(
+ e.message
+ .contains("Container size 200 exceeds maximum allowed size of 100")
+ );
}
_ => panic!("Expected protocol error with SizeLimit"),
}
@@ -1304,9 +1313,10 @@ mod tests {
match result {
Err(crate::Error::Protocol(e)) => {
assert_eq!(e.kind, ProtocolErrorKind::SizeLimit);
- assert!(e
- .message
- .contains("Byte array size 2000 exceeds maximum allowed size of 1000"));
+ assert!(
+ e.message
+ .contains("Byte array size 2000 exceeds maximum allowed size of 1000")
+ );
}
_ => panic!("Expected protocol error with SizeLimit"),
}
@@ -1331,9 +1341,10 @@ mod tests {
match result {
Err(crate::Error::Protocol(e)) => {
assert_eq!(e.kind, ProtocolErrorKind::SizeLimit);
- assert!(e
- .message
- .contains("Message name size 2000 exceeds maximum allowed size of 1000"));
+ assert!(
+ e.message
+ .contains("Message name size 2000 exceeds maximum allowed size of 1000")
+ );
}
_ => panic!("Expected protocol error with SizeLimit"),
}
diff --git a/lib/rs/src/protocol/compact.rs b/lib/rs/src/protocol/compact.rs
index 0706da430d8..b0fcf06fbd2 100644
--- a/lib/rs/src/protocol/compact.rs
+++ b/lib/rs/src/protocol/compact.rs
@@ -3176,9 +3176,10 @@ mod tests {
match result {
Err(crate::Error::Protocol(e)) => {
assert_eq!(e.kind, ProtocolErrorKind::SizeLimit);
- assert!(e
- .message
- .contains("1600 bytes, exceeding message size limit of 1000"));
+ assert!(
+ e.message
+ .contains("1600 bytes, exceeding message size limit of 1000")
+ );
}
_ => panic!("Expected protocol error with SizeLimit"),
}
diff --git a/lib/rs/src/protocol/mod.rs b/lib/rs/src/protocol/mod.rs
index 43b89401375..109b3c927ff 100644
--- a/lib/rs/src/protocol/mod.rs
+++ b/lib/rs/src/protocol/mod.rs
@@ -252,7 +252,7 @@ pub trait TInputProtocol {
}
u => Err(crate::Error::Protocol(ProtocolError {
kind: ProtocolErrorKind::Unknown,
- message: format!("cannot skip field type {:?}", &u),
+ message: format!("cannot skip field type {:?}", u),
})),
}
}
@@ -622,7 +622,7 @@ where
pub trait TOutputProtocolFactory {
/// Create a `TOutputProtocol` that writes bytes to `transport`.
fn create(&self, transport: Box)
- -> Box;
+ -> Box;
}
impl TOutputProtocolFactory for Box
diff --git a/lib/rs/src/server/mod.rs b/lib/rs/src/server/mod.rs
index 64c6da2e3cb..274aa9fab9a 100644
--- a/lib/rs/src/server/mod.rs
+++ b/lib/rs/src/server/mod.rs
@@ -92,7 +92,7 @@ pub trait TProcessor {
///
/// Returns `()` if the handler was executed; `Err` otherwise.
fn process(&self, i: &mut dyn TInputProtocol, o: &mut dyn TOutputProtocol)
- -> crate::Result<()>;
+ -> crate::Result<()>;
}
/// Convenience function used in generated `TProcessor` implementations to
diff --git a/lib/rs/src/server/multiplexed.rs b/lib/rs/src/server/multiplexed.rs
index 85126b7e23c..cd231ed3d74 100644
--- a/lib/rs/src/server/multiplexed.rs
+++ b/lib/rs/src/server/multiplexed.rs
@@ -25,7 +25,7 @@ use std::sync::{Arc, Mutex};
use crate::protocol::{TInputProtocol, TMessageIdentifier, TOutputProtocol, TStoredInputProtocol};
-use super::{handle_process_result, TProcessor};
+use super::{TProcessor, handle_process_result};
const MISSING_SEPARATOR_AND_NO_DEFAULT: &str =
"missing service separator and no default processor set";
@@ -109,7 +109,7 @@ impl TMultiplexedProcessor {
o_prot: &mut dyn TOutputProtocol,
) -> crate::Result<()> {
let (svc_name, svc_call) = split_ident_name(&msg_ident.name);
- debug!("routing svc_name {:?} svc_call {}", &svc_name, &svc_call);
+ debug!("routing svc_name {:?} svc_call {}", svc_name, svc_call);
let processor: Option> = {
let stored = self.stored.lock().unwrap();
@@ -143,7 +143,7 @@ impl TProcessor for TMultiplexedProcessor {
) -> crate::Result<()> {
let msg_ident = i_prot.read_message_begin()?;
- debug!("process incoming msg id:{:?}", &msg_ident);
+ debug!("process incoming msg id:{:?}", msg_ident);
let res = self.process_message(&msg_ident, i_prot, o_prot);
handle_process_result(&msg_ident, res, o_prot)
@@ -183,8 +183,8 @@ fn missing_processor_message(svc_name: Option<&str>) -> String {
#[cfg(test)]
mod tests {
use std::convert::Into;
- use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
+ use std::sync::atomic::{AtomicBool, Ordering};
use crate::protocol::{
TBinaryInputProtocol, TBinaryOutputProtocol, TMessageIdentifier, TMessageType,
diff --git a/lib/rs/src/transport/socket.rs b/lib/rs/src/transport/socket.rs
index 7ab5e4e6723..9053006e4f2 100644
--- a/lib/rs/src/transport/socket.rs
+++ b/lib/rs/src/transport/socket.rs
@@ -25,7 +25,7 @@ use std::time::Duration;
use std::os::unix::net::UnixStream;
use super::{ReadHalf, TIoChannel, WriteHalf};
-use crate::{new_transport_error, TransportErrorKind};
+use crate::{TransportErrorKind, new_transport_error};
/// Bidirectional TCP/IP channel.
///
diff --git a/lib/rs/src/transport/tls.rs b/lib/rs/src/transport/tls.rs
index 4f6d3417f24..bdb94e1e1f4 100644
--- a/lib/rs/src/transport/tls.rs
+++ b/lib/rs/src/transport/tls.rs
@@ -28,7 +28,7 @@ use rustls::{
};
use super::{ReadHalf, TIoChannel, TSharedChannel, WriteHalf};
-use crate::{new_transport_error, TransportErrorKind};
+use crate::{TransportErrorKind, new_transport_error};
/// A blocking rustls client channel.
///
diff --git a/lib/rs/test/Cargo.toml b/lib/rs/test/Cargo.toml
index 4c64f38f2e6..cbc508bbc66 100644
--- a/lib/rs/test/Cargo.toml
+++ b/lib/rs/test/Cargo.toml
@@ -1,7 +1,8 @@
[package]
name = "kitchen-sink"
version = "0.1.0"
-edition = "2021"
+edition = "2024"
+rust-version = "1.85"
license = "Apache-2.0"
authors = ["Apache Thrift Developers "]
publish = false
diff --git a/lib/rs/test/fuzz/Cargo.toml b/lib/rs/test/fuzz/Cargo.toml
index 38272b4e9c8..446bc038efa 100644
--- a/lib/rs/test/fuzz/Cargo.toml
+++ b/lib/rs/test/fuzz/Cargo.toml
@@ -19,7 +19,8 @@
name = "thrift-fuzz"
version = "0.0.0"
publish = false
-edition = "2021"
+edition = "2024"
+rust-version = "1.85"
[package.metadata]
cargo-fuzz = true
diff --git a/lib/rs/test/fuzz/fuzz_targets/parse_binary.rs b/lib/rs/test/fuzz/fuzz_targets/parse_binary.rs
index 9e1444a21d3..88a6d4943c6 100644
--- a/lib/rs/test/fuzz/fuzz_targets/parse_binary.rs
+++ b/lib/rs/test/fuzz/fuzz_targets/parse_binary.rs
@@ -17,10 +17,10 @@
#![no_main]
+use thrift::TConfiguration;
use thrift::protocol::TBinaryInputProtocol;
use thrift::protocol::TSerializable;
use thrift::transport::TBufferChannel;
-use thrift::TConfiguration;
use thrift_fuzz::fuzz_test::FuzzTest;
fn run(data: &[u8]) -> thrift::Result {
diff --git a/lib/rs/test/fuzz/fuzz_targets/parse_compact.rs b/lib/rs/test/fuzz/fuzz_targets/parse_compact.rs
index 91cd53290dc..7d14c72aa0c 100644
--- a/lib/rs/test/fuzz/fuzz_targets/parse_compact.rs
+++ b/lib/rs/test/fuzz/fuzz_targets/parse_compact.rs
@@ -17,10 +17,10 @@
#![no_main]
+use thrift::TConfiguration;
use thrift::protocol::TCompactInputProtocol;
use thrift::protocol::TSerializable;
use thrift::transport::TBufferChannel;
-use thrift::TConfiguration;
use thrift_fuzz::fuzz_test::FuzzTest;
fn run(data: &[u8]) -> thrift::Result {
diff --git a/lib/rs/test/fuzz/fuzz_targets/roundtrip_binary.rs b/lib/rs/test/fuzz/fuzz_targets/roundtrip_binary.rs
index 41b302b17e0..aeb70e37190 100644
--- a/lib/rs/test/fuzz/fuzz_targets/roundtrip_binary.rs
+++ b/lib/rs/test/fuzz/fuzz_targets/roundtrip_binary.rs
@@ -17,11 +17,11 @@
#![no_main]
+use thrift::TConfiguration;
use thrift::protocol::{
TBinaryInputProtocol, TBinaryOutputProtocol, TOutputProtocol, TSerializable,
};
use thrift::transport::TBufferChannel;
-use thrift::TConfiguration;
use thrift_fuzz::fuzz_test::FuzzTest;
fn run(data: &[u8]) -> thrift::Result<()> {
diff --git a/lib/rs/test/fuzz/fuzz_targets/roundtrip_compact.rs b/lib/rs/test/fuzz/fuzz_targets/roundtrip_compact.rs
index e8c8c332af0..243cf5cd3dd 100644
--- a/lib/rs/test/fuzz/fuzz_targets/roundtrip_compact.rs
+++ b/lib/rs/test/fuzz/fuzz_targets/roundtrip_compact.rs
@@ -17,11 +17,11 @@
#![no_main]
+use thrift::TConfiguration;
use thrift::protocol::{
TCompactInputProtocol, TCompactOutputProtocol, TOutputProtocol, TSerializable,
};
use thrift::transport::TBufferChannel;
-use thrift::TConfiguration;
use thrift_fuzz::fuzz_test::FuzzTest;
fn run(data: &[u8]) -> thrift::Result<()> {
diff --git a/lib/rs/test_recursive/Cargo.toml b/lib/rs/test_recursive/Cargo.toml
index 28dbf385ff8..f6fa36fc688 100644
--- a/lib/rs/test_recursive/Cargo.toml
+++ b/lib/rs/test_recursive/Cargo.toml
@@ -3,7 +3,8 @@ name = "thrift_4098_custom_rust_namespace_support"
description = "Test namespace support in generated thrift files using recursive Make generation"
version = "0.1.0"
authors = ["Allen George "]
-edition = "2021"
+edition = "2024"
+rust-version = "1.85"
[dependencies]
thrift = { path = "../" }
diff --git a/lib/rs/test_recursive/src/lib.rs b/lib/rs/test_recursive/src/lib.rs
index 5b9211c412c..dd23c838734 100644
--- a/lib/rs/test_recursive/src/lib.rs
+++ b/lib/rs/test_recursive/src/lib.rs
@@ -138,10 +138,10 @@ mod tests {
//
use crate::server::AllInOneHandler;
- use crate::transit::buses::{Bus, Powertrain, Route as BusRoute, DEFAULT4WHEELCAPACITY};
+ use crate::transit::buses::{Bus, DEFAULT4WHEELCAPACITY, Powertrain, Route as BusRoute};
use crate::transit::light::light_rail::Lrt;
use crate::transit::light::streetcars::{
- BarnSyncHandler, Flexity, RollingStock, Route, RouteNumber, Streetcar, CLRV,
+ BarnSyncHandler, CLRV, Flexity, RollingStock, Route, RouteNumber, Streetcar,
};
use crate::transit::services::city_services::TransitImprovements;
use crate::transit::trains::Locomotive;
diff --git a/lib/rs/tests/shared_channel.rs b/lib/rs/tests/shared_channel.rs
index 80651adac61..bdc4df84906 100644
--- a/lib/rs/tests/shared_channel.rs
+++ b/lib/rs/tests/shared_channel.rs
@@ -17,7 +17,7 @@
use std::collections::VecDeque;
use std::io::{self, Read, Write};
-use std::panic::{catch_unwind, AssertUnwindSafe};
+use std::panic::{AssertUnwindSafe, catch_unwind};
use std::sync::{Arc, Mutex};
use thrift::transport::{TIoChannel, TSharedChannel};
diff --git a/lib/rs/tests/tls.rs b/lib/rs/tests/tls.rs
index 723e8f10577..32e34150971 100644
--- a/lib/rs/tests/tls.rs
+++ b/lib/rs/tests/tls.rs
@@ -19,7 +19,7 @@
use std::io::{Read, Write};
use std::net::{TcpListener, TcpStream};
-use std::sync::{mpsc, Arc};
+use std::sync::{Arc, mpsc};
use std::thread;
use std::time::Duration;
diff --git a/rust-toolchain b/rust-toolchain
index 8510ffad036..9eb2e1ff9c2 100644
--- a/rust-toolchain
+++ b/rust-toolchain
@@ -1 +1 @@
-1.85.1
+1.99.0
diff --git a/test/rs/Cargo.toml b/test/rs/Cargo.toml
index c2827526c21..d39a9581eb8 100644
--- a/test/rs/Cargo.toml
+++ b/test/rs/Cargo.toml
@@ -1,7 +1,8 @@
[package]
name = "thrift-test"
version = "0.1.0"
-edition = "2021"
+edition = "2024"
+rust-version = "1.85"
license = "Apache-2.0"
authors = ["Apache Thrift Developers "]
publish = false
diff --git a/test/rs/src/bin/test_client.rs b/test/rs/src/bin/test_client.rs
index 998aebe6a20..e7e8bf079ca 100644
--- a/test/rs/src/bin/test_client.rs
+++ b/test/rs/src/bin/test_client.rs
@@ -33,6 +33,7 @@ use std::os::unix::net::UnixStream;
#[cfg(unix)]
use std::path::Path;
+use thrift::OrderedFloat;
use thrift::protocol::{
TBinaryInputProtocol, TBinaryOutputProtocol, TCompactInputProtocol, TCompactOutputProtocol,
TInputProtocol, TMultiplexedOutputProtocol, TOutputProtocol,
@@ -41,7 +42,6 @@ use thrift::transport::{
TBufferedReadTransport, TBufferedWriteTransport, TFramedReadTransport, TFramedWriteTransport,
TIoChannel, TReadTransport, TTcpChannel, TTlsClientChannel, TWriteTransport,
};
-use thrift::OrderedFloat;
use thrift_test::*;
const CLIENT_CERT: &[u8] = include_bytes!("../../../keys/client_v3.crt");
@@ -742,7 +742,7 @@ fn verify_expected_result(
} else {
info!("*** FAILED ***");
Err(thrift::Error::User(
- format!("expected {:?} but got {:?}", &expected, &v).into(),
+ format!("expected {:?} but got {:?}", expected, v).into(),
))
}
}
diff --git a/test/rs/src/bin/test_server.rs b/test/rs/src/bin/test_server.rs
index a076aa4757f..215137e9876 100644
--- a/test/rs/src/bin/test_server.rs
+++ b/test/rs/src/bin/test_server.rs
@@ -17,8 +17,8 @@
use clap::{clap_app, value_t};
use log::*;
-use rustls::pki_types::{CertificateDer, PrivateKeyDer};
use rustls::ServerConfig;
+use rustls::pki_types::{CertificateDer, PrivateKeyDer};
use std::collections::{BTreeMap, BTreeSet};
use std::io::Cursor;
@@ -26,6 +26,7 @@ use std::sync::Arc;
use std::thread;
use std::time::Duration;
+use thrift::OrderedFloat;
use thrift::protocol::{
TBinaryInputProtocolFactory, TBinaryOutputProtocolFactory, TCompactInputProtocolFactory,
TCompactOutputProtocolFactory, TInputProtocolFactory, TOutputProtocolFactory,
@@ -35,7 +36,6 @@ use thrift::transport::{
TBufferedReadTransportFactory, TBufferedWriteTransportFactory, TFramedReadTransportFactory,
TFramedWriteTransportFactory, TReadTransportFactory, TWriteTransportFactory,
};
-use thrift::OrderedFloat;
use thrift_test::*;
const SERVER_CERT: &[u8] = include_bytes!("../../../keys/server.crt");
@@ -207,12 +207,12 @@ impl ThriftTestSyncHandler for ThriftTestSyncHandlerImpl {
}
fn handle_test_string(&self, thing: String) -> thrift::Result {
- info!("testString({})", &thing);
+ info!("testString({})", thing);
Ok(thing)
}
fn handle_test_uuid(&self, thing: uuid::Uuid) -> thrift::Result {
- info!("testUUID({})", &thing);
+ info!("testUUID({})", thing);
Ok(thing)
}
@@ -425,8 +425,8 @@ impl ThriftTestSyncHandler for ThriftTestSyncHandlerImpl {
struct SecondServiceSyncHandlerImpl;
impl SecondServiceSyncHandler for SecondServiceSyncHandlerImpl {
fn handle_secondtest_string(&self, thing: String) -> thrift::Result {
- info!("(second)testString({})", &thing);
- let ret = format!("testString(\"{}\")", &thing);
+ info!("(second)testString({})", thing);
+ let ret = format!("testString(\"{}\")", thing);
Ok(ret)
}
}
diff --git a/tutorial/rs/Cargo.toml b/tutorial/rs/Cargo.toml
index 6967984325e..a26280ddbcc 100644
--- a/tutorial/rs/Cargo.toml
+++ b/tutorial/rs/Cargo.toml
@@ -1,7 +1,8 @@
[package]
name = "thrift-tutorial"
version = "0.1.0"
-edition = "2021"
+edition = "2024"
+rust-version = "1.85"
license = "Apache-2.0"
authors = ["Apache Thrift Developers "]
exclude = ["Makefile*", "shared.rs", "tutorial.rs"]
diff --git a/tutorial/rs/src/bin/tutorial_server.rs b/tutorial/rs/src/bin/tutorial_server.rs
index ab6df57fb06..fc893d9b452 100644
--- a/tutorial/rs/src/bin/tutorial_server.rs
+++ b/tutorial/rs/src/bin/tutorial_server.rs
@@ -121,16 +121,7 @@ impl CalculatorSyncHandler for CalculatorServer {
println!("handling calculate: l:{}, w:{:?}", logid, w);
let res = if let Some(ref op) = w.op {
- if w.num1.is_none() || w.num2.is_none() {
- Err(InvalidOperation {
- what_op: Some(op.into()),
- why: Some("no operands specified".to_owned()),
- })
- } else {
- // so that I don't have to call unwrap() multiple times below
- let num1 = w.num1.as_ref().expect("operands checked");
- let num2 = w.num2.as_ref().expect("operands checked");
-
+ if let (Some(num1), Some(num2)) = (w.num1.as_ref(), w.num2.as_ref()) {
match *op {
Operation::ADD => Ok(num1 + num2),
Operation::SUBTRACT => Ok(num1 - num2),
@@ -153,6 +144,11 @@ impl CalculatorSyncHandler for CalculatorServer {
})
}
}
+ } else {
+ Err(InvalidOperation {
+ what_op: Some(op.into()),
+ why: Some("no operands specified".to_owned()),
+ })
}
} else {
Err(InvalidOperation::new(