diff options
author | Danny Browning <danny.browning@protectwise.com> | 2019-08-21 13:41:07 -0600 |
---|---|---|
committer | Danny Browning <danny.browning@protectwise.com> | 2019-09-06 10:28:24 -0600 |
commit | 942bd8403b0b5ece17cfd5df46118cfa39386808 (patch) | |
tree | d6c0ac3f84862011de3e799799e1e45b08c8ac5e | |
parent | a715f701bf4850b41b7f3fa016d16a9153319e1e (diff) | |
download | thrift-942bd8403b0b5ece17cfd5df46118cfa39386808.tar.gz |
Bare Trait Warnings
Fixes bare trait (dyn) warnings in the library as well as generated code.
-rw-r--r-- | compiler/cpp/src/thrift/generate/t_rs_generator.cc | 26 | ||||
-rw-r--r-- | lib/rs/src/autogen.rs | 4 | ||||
-rw-r--r-- | lib/rs/src/errors.rs | 6 | ||||
-rw-r--r-- | lib/rs/src/lib.rs | 1 | ||||
-rw-r--r-- | lib/rs/src/protocol/binary.rs | 4 | ||||
-rw-r--r-- | lib/rs/src/protocol/compact.rs | 4 | ||||
-rw-r--r-- | lib/rs/src/protocol/mod.rs | 20 | ||||
-rw-r--r-- | lib/rs/src/protocol/stored.rs | 4 | ||||
-rw-r--r-- | lib/rs/src/server/mod.rs | 4 | ||||
-rw-r--r-- | lib/rs/src/server/multiplexed.rs | 12 | ||||
-rw-r--r-- | lib/rs/src/server/threaded.rs | 6 | ||||
-rw-r--r-- | lib/rs/src/transport/buffered.rs | 4 | ||||
-rw-r--r-- | lib/rs/src/transport/framed.rs | 4 | ||||
-rw-r--r-- | lib/rs/src/transport/mod.rs | 16 |
14 files changed, 58 insertions, 57 deletions
diff --git a/compiler/cpp/src/thrift/generate/t_rs_generator.cc b/compiler/cpp/src/thrift/generate/t_rs_generator.cc index f6b4b6dca..77ee906c7 100644 --- a/compiler/cpp/src/thrift/generate/t_rs_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_rs_generator.cc @@ -901,7 +901,7 @@ void t_rs_generator::render_enum_impl(const string& enum_name) { f_gen_ << indent() - << "pub fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {" + << "pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {" << endl; indent_up(); f_gen_ << indent() << "o_prot.write_i32(*self as i32)" << endl; @@ -910,7 +910,7 @@ void t_rs_generator::render_enum_impl(const string& enum_name) { f_gen_ << indent() - << "pub fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<" << enum_name << "> {" + << "pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<" << enum_name << "> {" << endl; indent_up(); @@ -1401,7 +1401,7 @@ void t_rs_generator::render_struct_sync_write( f_gen_ << indent() << visibility_qualifier(struct_type) - << "fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {" + << "fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {" << endl; indent_up(); @@ -1433,7 +1433,7 @@ void t_rs_generator::render_struct_sync_write( void t_rs_generator::render_union_sync_write(const string &union_name, t_struct *tstruct) { f_gen_ << indent() - << "pub fn write_to_out_protocol(&self, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {" + << "pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {" << endl; indent_up(); @@ -1675,7 +1675,7 @@ void t_rs_generator::render_struct_sync_read( f_gen_ << indent() << visibility_qualifier(struct_type) - << "fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<" << struct_name << "> {" + << "fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<" << struct_name << "> {" << endl; indent_up(); @@ -1797,7 +1797,7 @@ void t_rs_generator::render_struct_sync_read( void t_rs_generator::render_union_sync_read(const string &union_name, t_struct *tstruct) { f_gen_ << indent() - << "pub fn read_from_in_protocol(i_prot: &mut TInputProtocol) -> thrift::Result<" << union_name << "> {" + << "pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<" << union_name << "> {" << endl; indent_up(); @@ -2206,8 +2206,8 @@ void t_rs_generator::render_sync_client_tthriftclient_impl(const string &client_ << " {" << endl; indent_up(); - f_gen_ << indent() << "fn i_prot_mut(&mut self) -> &mut TInputProtocol { &mut self._i_prot }" << endl; - f_gen_ << indent() << "fn o_prot_mut(&mut self) -> &mut TOutputProtocol { &mut self._o_prot }" << endl; + f_gen_ << indent() << "fn i_prot_mut(&mut self) -> &mut dyn TInputProtocol { &mut self._i_prot }" << endl; + f_gen_ << indent() << "fn o_prot_mut(&mut self) -> &mut dyn TOutputProtocol { &mut self._o_prot }" << endl; f_gen_ << indent() << "fn sequence_number(&self) -> i32 { self._sequence_number }" << endl; f_gen_ << indent() @@ -2564,7 +2564,7 @@ void t_rs_generator::render_sync_processor_definition_and_impl(t_service *tservi f_gen_ << indent() - << "fn process(&self, i_prot: &mut TInputProtocol, o_prot: &mut TOutputProtocol) -> thrift::Result<()> {" + << "fn process(&self, i_prot: &mut dyn TInputProtocol, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {" << endl; indent_up(); @@ -2609,8 +2609,8 @@ void t_rs_generator::render_sync_process_delegation_functions(t_service *tservic << "fn " << function_name << "(&self, " << "incoming_sequence_number: i32, " - << "i_prot: &mut TInputProtocol, " - << "o_prot: &mut TOutputProtocol) " + << "i_prot: &mut dyn TInputProtocol, " + << "o_prot: &mut dyn TOutputProtocol) " << "-> thrift::Result<()> {" << endl; indent_up(); @@ -2674,8 +2674,8 @@ void t_rs_generator::render_sync_process_function(t_function *tfunc, const strin << "<H: " << handler_type << ">" << "(handler: &H, " << sequence_number_param << ": i32, " - << "i_prot: &mut TInputProtocol, " - << output_protocol_param << ": &mut TOutputProtocol) " + << "i_prot: &mut dyn TInputProtocol, " + << output_protocol_param << ": &mut dyn TOutputProtocol) " << "-> thrift::Result<()> {" << endl; diff --git a/lib/rs/src/autogen.rs b/lib/rs/src/autogen.rs index 54d4080e8..6806a08ce 100644 --- a/lib/rs/src/autogen.rs +++ b/lib/rs/src/autogen.rs @@ -29,10 +29,10 @@ use protocol::{TInputProtocol, TOutputProtocol}; pub trait TThriftClient { /// Returns the input protocol used to read serialized Thrift messages /// from the Thrift server. - fn i_prot_mut(&mut self) -> &mut TInputProtocol; + fn i_prot_mut(&mut self) -> &mut dyn TInputProtocol; /// Returns the output protocol used to write serialized Thrift messages /// to the Thrift server. - fn o_prot_mut(&mut self) -> &mut TOutputProtocol; + fn o_prot_mut(&mut self) -> &mut dyn TOutputProtocol; /// Returns the sequence number of the last message written to the Thrift /// server. Returns `0` if no messages have been written. Sequence /// numbers should *never* be negative, and this method returns an `i32` diff --git a/lib/rs/src/errors.rs b/lib/rs/src/errors.rs index 13be1ee06..68cdc9c17 100644 --- a/lib/rs/src/errors.rs +++ b/lib/rs/src/errors.rs @@ -188,7 +188,7 @@ pub enum Error { /// functions are automatically returned as an `ApplicationError`. Application(ApplicationError), /// IDL-defined exception structs. - User(Box<error::Error + Sync + Send>), + User(Box<dyn error::Error + Sync + Send>), } impl Error { @@ -196,7 +196,7 @@ impl Error { /// /// Application code **should never** call this method directly. pub fn read_application_error_from_in_protocol( - i: &mut TInputProtocol, + i: &mut dyn TInputProtocol, ) -> ::Result<ApplicationError> { let mut message = "general remote error".to_owned(); let mut kind = ApplicationErrorKind::Unknown; @@ -247,7 +247,7 @@ impl Error { /// Application code **should never** call this method directly. pub fn write_application_error_to_out_protocol( e: &ApplicationError, - o: &mut TOutputProtocol, + o: &mut dyn TOutputProtocol, ) -> ::Result<()> { o.write_struct_begin(&TStructIdentifier { name: "TApplicationException".to_owned(), diff --git a/lib/rs/src/lib.rs b/lib/rs/src/lib.rs index a36ec99c4..cdd60f0a9 100644 --- a/lib/rs/src/lib.rs +++ b/lib/rs/src/lib.rs @@ -47,6 +47,7 @@ #![crate_type = "lib"] #![doc(test(attr(allow(unused_variables), deny(warnings))))] +#![deny(bare_trait_objects)] extern crate byteorder; extern crate ordered_float; diff --git a/lib/rs/src/protocol/binary.rs b/lib/rs/src/protocol/binary.rs index 0920fc4e1..2069cf9fd 100644 --- a/lib/rs/src/protocol/binary.rs +++ b/lib/rs/src/protocol/binary.rs @@ -249,7 +249,7 @@ impl TBinaryInputProtocolFactory { } 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 TBinaryOutputProtocolFactory { } 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 334e8201b..1750bc42e 100644 --- a/lib/rs/src/protocol/compact.rs +++ b/lib/rs/src/protocol/compact.rs @@ -322,7 +322,7 @@ impl TCompactInputProtocolFactory { } 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 TCompactOutputProtocolFactory { } 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 1ab16585e..2d8513f2c 100644 --- a/lib/rs/src/protocol/mod.rs +++ b/lib/rs/src/protocol/mod.rs @@ -546,14 +546,14 @@ where /// ``` 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 @@ where /// ``` 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 @@ mod tests { #[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 4fe465fc6..faa51288e 100644 --- a/lib/rs/src/protocol/stored.rs +++ b/lib/rs/src/protocol/stored.rs @@ -79,7 +79,7 @@ use ProtocolErrorKind; /// ``` // FIXME: implement Debug pub struct TStoredInputProtocol<'a> { - inner: &'a mut TInputProtocol, + inner: &'a mut dyn TInputProtocol, message_ident: Option<TMessageIdentifier>, } @@ -90,7 +90,7 @@ impl<'a> TStoredInputProtocol<'a> { /// 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 { diff --git a/lib/rs/src/server/mod.rs b/lib/rs/src/server/mod.rs index 3d4289104..b719d1ba8 100644 --- a/lib/rs/src/server/mod.rs +++ b/lib/rs/src/server/mod.rs @@ -91,7 +91,7 @@ pub trait TProcessor { /// 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 trait TProcessor { 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 e433794a5..3f9bc78e4 100644 --- a/lib/rs/src/server/multiplexed.rs +++ b/lib/rs/src/server/multiplexed.rs @@ -27,7 +27,7 @@ use super::{handle_process_result, TProcessor}; 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 @@ impl TMultiplexedProcessor { 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 @@ impl TMultiplexedProcessor { 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 TMultiplexedProcessor { } 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 @@ mod tests { } 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 e15a25ab6..8f8c082d6 100644 --- a/lib/rs/src/server/threaded.rs +++ b/lib/rs/src/server/threaded.rs @@ -194,7 +194,7 @@ where 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 @@ where 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, { diff --git a/lib/rs/src/transport/buffered.rs b/lib/rs/src/transport/buffered.rs index 87cfeff96..b33eb4f55 100644 --- a/lib/rs/src/transport/buffered.rs +++ b/lib/rs/src/transport/buffered.rs @@ -139,7 +139,7 @@ impl TBufferedReadTransportFactory { impl TReadTransportFactory for TBufferedReadTransportFactory { /// Create a `TBufferedReadTransport`. - fn create(&self, channel: Box<Read + Send>) -> Box<TReadTransport + Send> { + fn create(&self, channel: Box<dyn Read + Send>) -> Box<dyn TReadTransport + Send> { Box::new(TBufferedReadTransport::new(channel)) } } @@ -254,7 +254,7 @@ impl TBufferedWriteTransportFactory { impl TWriteTransportFactory for TBufferedWriteTransportFactory { /// Create a `TBufferedWriteTransport`. - fn create(&self, channel: Box<Write + Send>) -> Box<TWriteTransport + Send> { + fn create(&self, channel: Box<dyn Write + Send>) -> Box<dyn TWriteTransport + Send> { Box::new(TBufferedWriteTransport::new(channel)) } } diff --git a/lib/rs/src/transport/framed.rs b/lib/rs/src/transport/framed.rs index a00930778..98ad1bb2f 100644 --- a/lib/rs/src/transport/framed.rs +++ b/lib/rs/src/transport/framed.rs @@ -121,7 +121,7 @@ impl TFramedReadTransportFactory { impl TReadTransportFactory for TFramedReadTransportFactory { /// Create a `TFramedReadTransport`. - fn create(&self, channel: Box<Read + Send>) -> Box<TReadTransport + Send> { + fn create(&self, channel: Box<dyn Read + Send>) -> Box<dyn TReadTransport + Send> { Box::new(TFramedReadTransport::new(channel)) } } @@ -231,7 +231,7 @@ impl TFramedWriteTransportFactory { impl TWriteTransportFactory for TFramedWriteTransportFactory { /// Create a `TFramedWriteTransport`. - fn create(&self, channel: Box<Write + Send>) -> Box<TWriteTransport + Send> { + fn create(&self, channel: Box<dyn Write + Send>) -> Box<dyn TWriteTransport + Send> { Box::new(TFramedWriteTransport::new(channel)) } } diff --git a/lib/rs/src/transport/mod.rs b/lib/rs/src/transport/mod.rs index a62335010..32c07998a 100644 --- a/lib/rs/src/transport/mod.rs +++ b/lib/rs/src/transport/mod.rs @@ -64,7 +64,7 @@ pub trait TReadTransport: Read {} /// accepted client connections. pub trait TReadTransportFactory { /// Create a `TTransport` that wraps a channel over which bytes are to be read. - fn create(&self, channel: Box<Read + Send>) -> Box<TReadTransport + Send>; + fn create(&self, channel: Box<dyn Read + Send>) -> Box<dyn TReadTransport + Send>; } /// Identifies a transport used by `TOutputProtocol` to send bytes. @@ -74,7 +74,7 @@ pub trait TWriteTransport: Write {} /// accepted client connections. pub trait TWriteTransportFactory { /// Create a `TTransport` that wraps a channel over which bytes are to be sent. - fn create(&self, channel: Box<Write + Send>) -> Box<TWriteTransport + Send>; + fn create(&self, channel: Box<dyn Write + Send>) -> Box<dyn TWriteTransport + Send>; } impl<T> TReadTransport for T where T: Read {} @@ -87,7 +87,7 @@ impl<T> TReadTransportFactory for Box<T> where T: TReadTransportFactory + ?Sized, { - fn create(&self, channel: Box<Read + Send>) -> Box<TReadTransport + Send> { + fn create(&self, channel: Box<dyn Read + Send>) -> Box<dyn TReadTransport + Send> { (**self).create(channel) } } @@ -96,7 +96,7 @@ impl<T> TWriteTransportFactory for Box<T> where T: TWriteTransportFactory + ?Sized, { - fn create(&self, channel: Box<Write + Send>) -> Box<TWriteTransport + Send> { + fn create(&self, channel: Box<dyn Write + Send>) -> Box<dyn TWriteTransport + Send> { (**self).create(channel) } } @@ -231,7 +231,7 @@ mod tests { #[test] fn must_create_usable_read_channel_from_boxed_read() { - let r: Box<Read> = Box::new(Cursor::new([0, 1, 2])); + let r: Box<dyn Read> = Box::new(Cursor::new([0, 1, 2])); let _ = TBufferedReadTransport::new(r); } @@ -243,7 +243,7 @@ mod tests { #[test] fn must_create_usable_write_channel_from_boxed_write() { - let w: Box<Write> = Box::new(vec![0u8; 10]); + let w: Box<dyn Write> = Box::new(vec![0u8; 10]); let _ = TBufferedWriteTransport::new(w); } @@ -257,7 +257,7 @@ mod tests { #[test] fn must_create_usable_read_transport_from_boxed_read() { let r = Cursor::new([0, 1, 2]); - let mut t: Box<TReadTransport> = Box::new(TBufferedReadTransport::new(r)); + let mut t: Box<dyn TReadTransport> = Box::new(TBufferedReadTransport::new(r)); takes_read_transport(&mut t) } @@ -271,7 +271,7 @@ mod tests { #[test] fn must_create_usable_write_transport_from_boxed_write() { let w = vec![0u8; 10]; - let mut t: Box<TWriteTransport> = Box::new(TBufferedWriteTransport::new(w)); + let mut t: Box<dyn TWriteTransport> = Box::new(TBufferedWriteTransport::new(w)); takes_write_transport(&mut t) } |