diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bitfield.rs | 4 | ||||
-rw-r--r-- | src/lib.rs | 2 | ||||
-rw-r--r-- | src/metadata_msgs.rs | 30 | ||||
-rw-r--r-- | src/network_msgs.rs | 110 | ||||
-rw-r--r-- | src/peer.rs | 2 | ||||
-rw-r--r-- | src/protocol.rs | 4 | ||||
-rw-r--r-- | src/sleep_register.rs | 6 | ||||
-rw-r--r-- | src/synchronizer.rs | 2 |
8 files changed, 80 insertions, 80 deletions
diff --git a/src/bitfield.rs b/src/bitfield.rs index 018ccbc..59fa0ed 100644 --- a/src/bitfield.rs +++ b/src/bitfield.rs @@ -10,11 +10,11 @@ pub struct Bitfield { impl Bitfield { - pub fn from_have_msg(msg: &Have) -> Bitfield { + pub fn from_have_msg(_msg: &Have) -> Bitfield { unimplemented!() } - pub fn get(&self, index: u64) -> Result<bool> { + pub fn get(&self, _index: u64) -> Result<bool> { unimplemented!() } } @@ -33,7 +33,7 @@ extern crate bit_vec; #[cfg(test)] extern crate tempdir; -#[allow(unused_doc_comment)] +#[allow(unused_doc_comments)] mod errors { // Create the Error, ErrorKind, ResultExt, and Result types diff --git a/src/metadata_msgs.rs b/src/metadata_msgs.rs index 3df9a4d..d1775ef 100644 --- a/src/metadata_msgs.rs +++ b/src/metadata_msgs.rs @@ -202,13 +202,13 @@ impl ::protobuf::Message for Index { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { self } @@ -712,13 +712,13 @@ impl ::protobuf::Message for Stat { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { self } @@ -1057,13 +1057,13 @@ impl ::protobuf::Message for Node { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { self } diff --git a/src/network_msgs.rs b/src/network_msgs.rs index e9dae76..0a84339 100644 --- a/src/network_msgs.rs +++ b/src/network_msgs.rs @@ -202,13 +202,13 @@ impl ::protobuf::Message for Feed { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { self } @@ -532,13 +532,13 @@ impl ::protobuf::Message for Handshake { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { self } @@ -764,13 +764,13 @@ impl ::protobuf::Message for Info { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { self } @@ -1041,13 +1041,13 @@ impl ::protobuf::Message for Have { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { self } @@ -1270,13 +1270,13 @@ impl ::protobuf::Message for Unhave { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { self } @@ -1493,13 +1493,13 @@ impl ::protobuf::Message for Want { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { self } @@ -1716,13 +1716,13 @@ impl ::protobuf::Message for Unwant { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { self } @@ -2021,13 +2021,13 @@ impl ::protobuf::Message for Request { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { self } @@ -2297,13 +2297,13 @@ impl ::protobuf::Message for Cancel { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { self } @@ -2644,13 +2644,13 @@ impl ::protobuf::Message for Data { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { self } @@ -2939,13 +2939,13 @@ impl ::protobuf::Message for Data_Node { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> { self } diff --git a/src/peer.rs b/src/peer.rs index a020a1a..2452524 100644 --- a/src/peer.rs +++ b/src/peer.rs @@ -122,7 +122,7 @@ impl DatPeerThread { let local_id = match local_id { None => None, - Some(val) => { + Some(_val) => { Some(&id_buf[..]) }, }; diff --git a/src/protocol.rs b/src/protocol.rs index 35681e1..a45c1ca 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -43,7 +43,7 @@ fn msg_code(msg: &DatNetMessage) -> u8 { } } -fn msg_sugar(msg: &DatNetMessage) -> &Message { +fn msg_sugar(msg: &DatNetMessage) -> &dyn Message { match msg { &DatNetMessage::Feed(ref m) => m, &DatNetMessage::Handshake(ref m) => m, @@ -283,7 +283,7 @@ impl DatConnection { /// For hyperdrive connections, `feed_index` is equivalent to a `is_content` boolean flag. pub fn send_msg(&mut self, dnm: &DatNetMessage, feed_index: u8) -> Result<()> { let header_int: u8 = (feed_index as u8) << 4 | (msg_code(dnm) & 0x0F); - let msg: &Message = msg_sugar(dnm); + let msg: &dyn Message = msg_sugar(dnm); let total_message_size = (msg.compute_size() as usize) + 1; trace!( diff --git a/src/sleep_register.rs b/src/sleep_register.rs index e0ea5a4..7151c0e 100644 --- a/src/sleep_register.rs +++ b/src/sleep_register.rs @@ -53,7 +53,7 @@ pub trait HyperRegister { fn get_tree_entry(&mut self, tree_index: u64) -> Result<Vec<u8>>; } -impl HyperRegister { +impl dyn HyperRegister { fn hash_leaf(data: &[u8]) -> [u8; 40] { let mut buf = [0; 40]; u64::to_be(data.len() as u64).encode_fixed(&mut buf[32..40]); @@ -82,7 +82,7 @@ impl HyperRegister { } /// Hashes all the tree root parents for the given entry index (data index, not tree index). - pub fn hash_roots(reg: &mut HyperRegister, entry_index: u64) -> Result<Vec<u8>> { + pub fn hash_roots(reg: &mut dyn HyperRegister, entry_index: u64) -> Result<Vec<u8>> { let mut buf = [0; 32]; let mut hash = Blake2b::new(32); let mut index_buf = [0; 8]; @@ -130,7 +130,7 @@ impl HyperRegister { /// Finds the offset of the given data chunk in the linear appended data file (not a "checked /// out" individual file) - pub fn get_data_offset(reg: &mut HyperRegister, entry_index: u64) -> Result<u64> { + pub fn get_data_offset(reg: &mut dyn HyperRegister, entry_index: u64) -> Result<u64> { // TODO: this is a naive (linear) implementation // log(N) would go up previous parent nodes (eg, use root_nodes()) let mut sum: u64 = 0; diff --git a/src/synchronizer.rs b/src/synchronizer.rs index cfc4cd3..a6f18ee 100644 --- a/src/synchronizer.rs +++ b/src/synchronizer.rs @@ -282,7 +282,7 @@ fn init_want_everything(dpt: &mut DatPeerThread, reg_index: u8) -> Result<()> { } /// Tries to connect to a single peer, pull register, and close. -pub fn node_simple_clone(host_port: &str, key: &[u8], register: &mut HyperRegister, reg_index: u8) -> Result<()> { +pub fn node_simple_clone(host_port: &str, key: &[u8], register: &mut dyn HyperRegister, reg_index: u8) -> Result<()> { if register.len()? > 0 { bail!("Register already had data in it (expected empty for naive clone)"); |