Bare Trait Warnings
Fixes bare trait (dyn) warnings in the library as well as generated code.
diff --git a/lib/rs/src/protocol/binary.rs b/lib/rs/src/protocol/binary.rs
index 0920fc4..2069cf9 100644
--- a/lib/rs/src/protocol/binary.rs
+++ b/lib/rs/src/protocol/binary.rs
@@ -249,7 +249,7 @@
}
impl TInputProtocolFactory for TBinaryInputProtocolFactory {
- fn create(&self, transport: Box<TReadTransport + Send>) -> Box<TInputProtocol + Send> {
+ fn create(&self, transport: Box<dyn TReadTransport + Send>) -> Box<dyn TInputProtocol + Send> {
Box::new(TBinaryInputProtocol::new(transport, true))
}
}
@@ -453,7 +453,7 @@
}
impl TOutputProtocolFactory for TBinaryOutputProtocolFactory {
- fn create(&self, transport: Box<TWriteTransport + Send>) -> Box<TOutputProtocol + Send> {
+ fn create(&self, transport: Box<dyn TWriteTransport + Send>) -> Box<dyn TOutputProtocol + Send> {
Box::new(TBinaryOutputProtocol::new(transport, true))
}
}
diff --git a/lib/rs/src/protocol/compact.rs b/lib/rs/src/protocol/compact.rs
index 334e820..1750bc4 100644
--- a/lib/rs/src/protocol/compact.rs
+++ b/lib/rs/src/protocol/compact.rs
@@ -322,7 +322,7 @@
}
impl TInputProtocolFactory for TCompactInputProtocolFactory {
- fn create(&self, transport: Box<TReadTransport + Send>) -> Box<TInputProtocol + Send> {
+ fn create(&self, transport: Box<dyn TReadTransport + Send>) -> Box<dyn TInputProtocol + Send> {
Box::new(TCompactInputProtocol::new(transport))
}
}
@@ -593,7 +593,7 @@
}
impl TOutputProtocolFactory for TCompactOutputProtocolFactory {
- fn create(&self, transport: Box<TWriteTransport + Send>) -> Box<TOutputProtocol + Send> {
+ fn create(&self, transport: Box<dyn TWriteTransport + Send>) -> Box<dyn TOutputProtocol + Send> {
Box::new(TCompactOutputProtocol::new(transport))
}
}
diff --git a/lib/rs/src/protocol/mod.rs b/lib/rs/src/protocol/mod.rs
index 1ab1658..2d8513f 100644
--- a/lib/rs/src/protocol/mod.rs
+++ b/lib/rs/src/protocol/mod.rs
@@ -546,14 +546,14 @@
/// ```
pub trait TInputProtocolFactory {
// Create a `TInputProtocol` that reads bytes from `transport`.
- fn create(&self, transport: Box<TReadTransport + Send>) -> Box<TInputProtocol + Send>;
+ fn create(&self, transport: Box<dyn TReadTransport + Send>) -> Box<dyn TInputProtocol + Send>;
}
impl<T> TInputProtocolFactory for Box<T>
where
T: TInputProtocolFactory + ?Sized,
{
- fn create(&self, transport: Box<TReadTransport + Send>) -> Box<TInputProtocol + Send> {
+ fn create(&self, transport: Box<dyn TReadTransport + Send>) -> Box<dyn TInputProtocol + Send> {
(**self).create(transport)
}
}
@@ -577,14 +577,14 @@
/// ```
pub trait TOutputProtocolFactory {
/// Create a `TOutputProtocol` that writes bytes to `transport`.
- fn create(&self, transport: Box<TWriteTransport + Send>) -> Box<TOutputProtocol + Send>;
+ fn create(&self, transport: Box<dyn TWriteTransport + Send>) -> Box<dyn TOutputProtocol + Send>;
}
impl<T> TOutputProtocolFactory for Box<T>
where
T: TOutputProtocolFactory + ?Sized,
{
- fn create(&self, transport: Box<TWriteTransport + Send>) -> Box<TOutputProtocol + Send> {
+ fn create(&self, transport: Box<dyn TWriteTransport + Send>) -> Box<dyn TOutputProtocol + Send> {
(**self).create(transport)
}
}
@@ -926,29 +926,29 @@
#[test]
fn must_create_usable_input_protocol_from_concrete_input_protocol() {
- let r: Box<TReadTransport> = Box::new(Cursor::new([0, 1, 2]));
+ let r: Box<dyn TReadTransport> = Box::new(Cursor::new([0, 1, 2]));
let mut t = TCompactInputProtocol::new(r);
takes_input_protocol(&mut t)
}
#[test]
fn must_create_usable_input_protocol_from_boxed_input() {
- let r: Box<TReadTransport> = Box::new(Cursor::new([0, 1, 2]));
- let mut t: Box<TInputProtocol> = Box::new(TCompactInputProtocol::new(r));
+ let r: Box<dyn TReadTransport> = Box::new(Cursor::new([0, 1, 2]));
+ let mut t: Box<dyn TInputProtocol> = Box::new(TCompactInputProtocol::new(r));
takes_input_protocol(&mut t)
}
#[test]
fn must_create_usable_output_protocol_from_concrete_output_protocol() {
- let w: Box<TWriteTransport> = Box::new(vec![0u8; 10]);
+ let w: Box<dyn TWriteTransport> = Box::new(vec![0u8; 10]);
let mut t = TCompactOutputProtocol::new(w);
takes_output_protocol(&mut t)
}
#[test]
fn must_create_usable_output_protocol_from_boxed_output() {
- let w: Box<TWriteTransport> = Box::new(vec![0u8; 10]);
- let mut t: Box<TOutputProtocol> = Box::new(TCompactOutputProtocol::new(w));
+ let w: Box<dyn TWriteTransport> = Box::new(vec![0u8; 10]);
+ let mut t: Box<dyn TOutputProtocol> = Box::new(TCompactOutputProtocol::new(w));
takes_output_protocol(&mut t)
}
diff --git a/lib/rs/src/protocol/stored.rs b/lib/rs/src/protocol/stored.rs
index 4fe465f..faa5128 100644
--- a/lib/rs/src/protocol/stored.rs
+++ b/lib/rs/src/protocol/stored.rs
@@ -79,7 +79,7 @@
/// ```
// FIXME: implement Debug
pub struct TStoredInputProtocol<'a> {
- inner: &'a mut TInputProtocol,
+ inner: &'a mut dyn TInputProtocol,
message_ident: Option<TMessageIdentifier>,
}
@@ -90,7 +90,7 @@
/// with service name stripped - that will be passed to
/// `wrapped.read_message_begin(...)`.
pub fn new(
- wrapped: &mut TInputProtocol,
+ wrapped: &mut dyn TInputProtocol,
message_ident: TMessageIdentifier,
) -> TStoredInputProtocol {
TStoredInputProtocol {