chiark / gitweb /
BROKEN
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 2 Feb 2022 17:59:53 +0000 (17:59 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 2 Feb 2022 17:59:53 +0000 (17:59 +0000)
src/main.rs

index a1b0ad010ce8dad0f5f3521d21c97293d2e58b8c..c9d96b26a94bffdc7d3ffcd6cf35a522da0d6e73 100644 (file)
@@ -1,51 +1,18 @@
 
-#![warn(noop_method_call)]
-#![deny(unreachable_pub)]
-#![deny(clippy::all)]
-#![deny(clippy::await_holding_lock)]
-#![deny(clippy::cast_lossless)]
-#![deny(clippy::checked_conversions)]
-#![warn(clippy::clone_on_ref_ptr)]
-#![warn(clippy::cognitive_complexity)]
-#![deny(clippy::debug_assert_with_mut_call)]
-#![deny(clippy::exhaustive_enums)]
-#![deny(clippy::exhaustive_structs)]
-#![deny(clippy::expl_impl_clone_on_copy)]
-#![deny(clippy::fallible_impl_from)]
-#![deny(clippy::implicit_clone)]
-#![deny(clippy::large_stack_arrays)]
-#![warn(clippy::manual_ok_or)]
-#![warn(clippy::needless_borrow)]
-#![warn(clippy::needless_pass_by_value)]
-#![warn(clippy::option_option)]
-#![warn(clippy::rc_buffer)]
-#![deny(clippy::ref_option_ref)]
-#![warn(clippy::semicolon_if_nothing_returned)]
-#![warn(clippy::trait_duplication_in_bounds)]
-#![deny(clippy::unnecessary_wraps)]
-#![warn(clippy::unseparated_literal_suffix)]
-#![deny(clippy::unwrap_used)]
-
-
-/// Internal: traits in common different cell bodies.
 pub trait Body: Sized {
-    /// Convert this type into a RelayMsg, wrapped appropriate.
-    fn into_message(self) -> RelayMsg;
-    /// Decode a relay cell body from a provided reader.
-    fn decode_from_reader(r: &mut Reader<'_>) -> Result<Self>;
-    /// Encode the body of this cell into the end of a vec.
     fn encode_onto(self, w: &mut Vec<u8>);
 }
 
+struct Wombat;
 
-
-fn mutate(w: &mut Vec<u8>) {
-    w.push(0);
+impl Body for Wombat {
+    fn encode_onto(self, w: &mut Vec<u8>) {
+        w.push(0);
+    }
 }
 
-
 fn main() {
     let mut w = vec![42];
-    mutate(&mut w);
+    Wombat.encode_onto(&mut w);
     println!("{:?}", &w);
 }