THRIFT-4960 bare trait (dyn) warnings
Client: Rust
Patch: Danny Browning
This closes #1851
diff --git a/lib/rs/src/server/mod.rs b/lib/rs/src/server/mod.rs
index 3d42891..b719d1b 100644
--- a/lib/rs/src/server/mod.rs
+++ b/lib/rs/src/server/mod.rs
@@ -91,7 +91,7 @@
/// the response to `o`.
///
/// Returns `()` if the handler was executed; `Err` otherwise.
- fn process(&self, i: &mut TInputProtocol, o: &mut TOutputProtocol) -> ::Result<()>;
+ fn process(&self, i: &mut dyn TInputProtocol, o: &mut dyn TOutputProtocol) -> ::Result<()>;
}
/// Convenience function used in generated `TProcessor` implementations to
@@ -99,7 +99,7 @@
pub fn handle_process_result(
msg_ident: &TMessageIdentifier,
res: ::Result<()>,
- o_prot: &mut TOutputProtocol,
+ o_prot: &mut dyn TOutputProtocol,
) -> ::Result<()> {
if let Err(e) = res {
let e = match e {
diff --git a/lib/rs/src/server/multiplexed.rs b/lib/rs/src/server/multiplexed.rs
index e433794..3f9bc78 100644
--- a/lib/rs/src/server/multiplexed.rs
+++ b/lib/rs/src/server/multiplexed.rs
@@ -27,7 +27,7 @@
const MISSING_SEPARATOR_AND_NO_DEFAULT: &'static str =
"missing service separator and no default processor set";
-type ThreadSafeProcessor = Box<TProcessor + Send + Sync>;
+type ThreadSafeProcessor = Box<dyn TProcessor + Send + Sync>;
/// A `TProcessor` that can demux service calls to multiple underlying
/// Thrift services.
@@ -74,7 +74,7 @@
pub fn register<S: Into<String>>(
&mut self,
service_name: S,
- processor: Box<TProcessor + Send + Sync>,
+ processor: Box<dyn TProcessor + Send + Sync>,
as_default: bool,
) -> ::Result<()> {
let mut stored = self.stored.lock().unwrap();
@@ -103,8 +103,8 @@
fn process_message(
&self,
msg_ident: &TMessageIdentifier,
- i_prot: &mut TInputProtocol,
- o_prot: &mut TOutputProtocol,
+ i_prot: &mut dyn TInputProtocol,
+ o_prot: &mut dyn TOutputProtocol,
) -> ::Result<()> {
let (svc_name, svc_call) = split_ident_name(&msg_ident.name);
debug!("routing svc_name {:?} svc_call {}", &svc_name, &svc_call);
@@ -134,7 +134,7 @@
}
impl TProcessor for TMultiplexedProcessor {
- fn process(&self, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> ::Result<()> {
+ fn process(&self, i_prot: &mut dyn TInputProtocol, o_prot: &mut dyn TOutputProtocol) -> ::Result<()> {
let msg_ident = i_prot.read_message_begin()?;
debug!("process incoming msg id:{:?}", &msg_ident);
@@ -259,7 +259,7 @@
}
impl TProcessor for Service {
- fn process(&self, _: &mut TInputProtocol, _: &mut TOutputProtocol) -> ::Result<()> {
+ fn process(&self, _: &mut dyn TInputProtocol, _: &mut dyn TOutputProtocol) -> ::Result<()> {
let res = self
.invoked
.compare_and_swap(false, true, Ordering::Relaxed);
diff --git a/lib/rs/src/server/threaded.rs b/lib/rs/src/server/threaded.rs
index e15a25a..8f8c082 100644
--- a/lib/rs/src/server/threaded.rs
+++ b/lib/rs/src/server/threaded.rs
@@ -194,7 +194,7 @@
fn new_protocols_for_connection(
&mut self,
stream: TcpStream,
- ) -> ::Result<(Box<TInputProtocol + Send>, Box<TOutputProtocol + Send>)> {
+ ) -> ::Result<(Box<dyn TInputProtocol + Send>, Box<dyn TOutputProtocol + Send>)> {
// create the shared tcp stream
let channel = TTcpChannel::with_stream(stream);
@@ -216,8 +216,8 @@
fn handle_incoming_connection<PRC>(
processor: Arc<PRC>,
- i_prot: Box<TInputProtocol>,
- o_prot: Box<TOutputProtocol>,
+ i_prot: Box<dyn TInputProtocol>,
+ o_prot: Box<dyn TOutputProtocol>,
) where
PRC: TProcessor,
{