THRIFT-5741: use rust 1.65 (#2870)
* use rust 1.65
* fix clippy
* fix alert
* fix protocol
* fix one more dereference
* fix more lint
* fix over-fix
* fix match &*server_type {
diff --git a/lib/rs/README.md b/lib/rs/README.md
index 010bb17..51aa63e 100644
--- a/lib/rs/README.md
+++ b/lib/rs/README.md
@@ -177,7 +177,7 @@
##### Thrift 0.14.0
-* **[THRIFT-5158]** - Rust library and generator now support Rust 2021 only. Required rust 1.61.0 or higher
+* **[THRIFT-5158]** - Rust library and generator now support Rust 2021 only. Required rust 1.65.0 or higher
The Rust `thrift` library was updated to Rust 2021 via `cargo fix --edition`.
All test code in the repo was updated as well. The code generator was also updated
diff --git a/lib/rs/src/protocol/binary.rs b/lib/rs/src/protocol/binary.rs
index 5da8018..b4b51f6 100644
--- a/lib/rs/src/protocol/binary.rs
+++ b/lib/rs/src/protocol/binary.rs
@@ -59,7 +59,7 @@
pub transport: T, // FIXME: shouldn't be public
}
-impl<'a, T> TBinaryInputProtocol<T>
+impl<T> TBinaryInputProtocol<T>
where
T: TReadTransport,
{
@@ -861,7 +861,7 @@
set_readable_bytes!(i_prot, &[0x01]);
let read_bool = assert_success!(i_prot.read_bool());
- assert_eq!(read_bool, true);
+ assert!(read_bool);
}
#[test]
@@ -871,7 +871,7 @@
set_readable_bytes!(i_prot, &[0x00]);
let read_bool = assert_success!(i_prot.read_bool());
- assert_eq!(read_bool, false);
+ assert!(!read_bool);
}
#[test]
@@ -881,7 +881,7 @@
set_readable_bytes!(i_prot, &[0xAC]);
let read_bool = assert_success!(i_prot.read_bool());
- assert_eq!(read_bool, true);
+ assert!(read_bool);
}
#[test]
diff --git a/lib/rs/src/protocol/compact.rs b/lib/rs/src/protocol/compact.rs
index a1aa253..c0c4372 100644
--- a/lib/rs/src/protocol/compact.rs
+++ b/lib/rs/src/protocol/compact.rs
@@ -2461,7 +2461,7 @@
}
);
let read_value_1 = assert_success!(i_prot.read_bool());
- assert_eq!(read_value_1, true);
+ assert!(read_value_1);
assert_success!(i_prot.read_field_end());
let read_ident_2 = assert_success!(i_prot.read_field_begin());
@@ -2473,7 +2473,7 @@
}
);
let read_value_2 = assert_success!(i_prot.read_bool());
- assert_eq!(read_value_2, false);
+ assert!(!read_value_2);
assert_success!(i_prot.read_field_end());
let read_ident_3 = assert_success!(i_prot.read_field_begin());
@@ -2485,7 +2485,7 @@
}
);
let read_value_3 = assert_success!(i_prot.read_bool());
- assert_eq!(read_value_3, true);
+ assert!(read_value_3);
assert_success!(i_prot.read_field_end());
let read_ident_4 = assert_success!(i_prot.read_field_begin());
@@ -2497,7 +2497,7 @@
}
);
let read_value_4 = assert_success!(i_prot.read_bool());
- assert_eq!(read_value_4, false);
+ assert!(!read_value_4);
assert_success!(i_prot.read_field_end());
let read_ident_5 = assert_success!(i_prot.read_field_begin());
@@ -2774,16 +2774,16 @@
assert_eq!(&rcvd_ident, &map_ident);
// key 1
let b = assert_success!(i_prot.read_bool());
- assert_eq!(b, true);
+ assert!(b);
// val 1
let b = assert_success!(i_prot.read_bool());
- assert_eq!(b, false);
+ assert!(!b);
// key 2
let b = assert_success!(i_prot.read_bool());
- assert_eq!(b, false);
+ assert!(!b);
// val 2
let b = assert_success!(i_prot.read_bool());
- assert_eq!(b, true);
+ assert!(b);
// map end
assert_success!(i_prot.read_map_end());
}
diff --git a/lib/rs/src/server/multiplexed.rs b/lib/rs/src/server/multiplexed.rs
index f6811a4..85126b7 100644
--- a/lib/rs/src/server/multiplexed.rs
+++ b/lib/rs/src/server/multiplexed.rs
@@ -197,7 +197,7 @@
#[test]
fn should_split_name_into_proper_separator_and_service_call() {
let ident_name = "foo:bar_call";
- let (serv, call) = split_ident_name(&ident_name);
+ let (serv, call) = split_ident_name(ident_name);
assert_eq!(serv, Some("foo"));
assert_eq!(call, "bar_call");
}
@@ -205,7 +205,7 @@
#[test]
fn should_return_full_ident_if_no_separator_exists() {
let ident_name = "bar_call";
- let (serv, call) = split_ident_name(&ident_name);
+ let (serv, call) = split_ident_name(ident_name);
assert_eq!(serv, None);
assert_eq!(call, "bar_call");
}
@@ -311,8 +311,8 @@
p.process(&mut i, &mut o).unwrap();
// service 1 should have been invoked, not service 2
- assert_eq!(atm_1.load(Ordering::Relaxed), true);
- assert_eq!(atm_2.load(Ordering::Relaxed), false);
+ assert!(atm_1.load(Ordering::Relaxed));
+ assert!(!atm_2.load(Ordering::Relaxed));
}
#[test]
@@ -344,8 +344,8 @@
p.process(&mut i, &mut o).unwrap();
// service 2 should have been invoked, not service 1
- assert_eq!(atm_1.load(Ordering::Relaxed), false);
- assert_eq!(atm_2.load(Ordering::Relaxed), true);
+ assert!(!atm_1.load(Ordering::Relaxed));
+ assert!(atm_2.load(Ordering::Relaxed));
}
fn build_objects() -> (
diff --git a/lib/rs/test/src/bin/kitchen_sink_server.rs b/lib/rs/test/src/bin/kitchen_sink_server.rs
index 1abd07c..6595d63 100644
--- a/lib/rs/test/src/bin/kitchen_sink_server.rs
+++ b/lib/rs/test/src/bin/kitchen_sink_server.rs
@@ -93,7 +93,7 @@
let (i_protocol_factory, o_protocol_factory): (
Box<dyn TInputProtocolFactory>,
Box<dyn TOutputProtocolFactory>,
- ) = match &*protocol {
+ ) = match protocol {
"binary" => (
Box::new(TBinaryInputProtocolFactory::new()),
Box::new(TBinaryOutputProtocolFactory::new()),
@@ -117,7 +117,7 @@
// different processor) this isn't possible.
//
// Since what I'm doing is uncommon I'm just going to duplicate the code
- match &*service {
+ match service {
"part" => run_meal_server(
socket,
r_transport_factory,