THRIFT-5819: use latest rustc version for rustlib (#3085)
Client: rust
This upgrades the version of rust in the rust-toolchain file, docs and dockerfiles. Doing so requires a few changes to the source, mainly to fix or silence new warnings.
Submitted on behalf of a third-party: Jiayu Liu
Derived from the following PR: https://github.com/apache/thrift/pull/3045
Co-authored-by: Jiayu Liu <jiayu@hey.com>
diff --git a/lib/rs/src/protocol/compact.rs b/lib/rs/src/protocol/compact.rs
index c0c4372..8ed4e06 100644
--- a/lib/rs/src/protocol/compact.rs
+++ b/lib/rs/src/protocol/compact.rs
@@ -681,8 +681,6 @@
#[cfg(test)]
mod tests {
- use std::i32;
-
use crate::protocol::{
TFieldIdentifier, TInputProtocol, TListIdentifier, TMapIdentifier, TMessageIdentifier,
TMessageType, TOutputProtocol, TSetIdentifier, TStructIdentifier, TType,
@@ -2818,7 +2816,7 @@
copy_write_buffer_to_read_buffer!(o_prot);
let read_double = i_prot.read_double().unwrap();
- assert!(read_double - double < std::f64::EPSILON);
+ assert!((read_double - double).abs() < f64::EPSILON);
}
#[test]
diff --git a/lib/rs/src/protocol/stored.rs b/lib/rs/src/protocol/stored.rs
index f4bdfb1..04d3277 100644
--- a/lib/rs/src/protocol/stored.rs
+++ b/lib/rs/src/protocol/stored.rs
@@ -83,6 +83,8 @@
message_ident: Option<TMessageIdentifier>,
}
+// Erroneous suggestion by clippy
+#[allow(clippy::needless_lifetimes)]
impl<'a> TStoredInputProtocol<'a> {
/// Create a `TStoredInputProtocol` that delegates all calls other than
/// `TInputProtocol::read_message_begin(...)` to a `wrapped`
@@ -100,6 +102,8 @@
}
}
+// Erroneous suggestion by clippy
+#[allow(clippy::needless_lifetimes)]
impl<'a> TInputProtocol for TStoredInputProtocol<'a> {
fn read_message_begin(&mut self) -> crate::Result<TMessageIdentifier> {
self.message_ident.take().ok_or_else(|| {