浏览代码

Fix double tracing in the loopback example.

whitequark 7 年之前
父节点
当前提交
abb0c11b95
共有 1 个文件被更改,包括 2 次插入8 次删除
  1. 2 8
      examples/loopback.rs

+ 2 - 8
examples/loopback.rs

@@ -15,7 +15,6 @@ mod utils;
 
 use smoltcp::Error;
 use smoltcp::phy::Loopback;
-use smoltcp::phy::EthernetTracer;
 use smoltcp::wire::{EthernetAddress, IpAddress};
 use smoltcp::iface::{ArpCache, SliceArpCache, EthernetInterface};
 use smoltcp::socket::{AsSocket, SocketSet};
@@ -69,18 +68,13 @@ mod mock {
 
 fn main() {
     let clock = mock::Clock::new();
+    let mut device = Loopback::new();
 
     #[cfg(feature = "std")]
-    {
+    let mut device = {
         let clock = clock.clone();
         utils::setup_logging_with_clock("", move || clock.elapsed());
-    }
 
-    let mut device = Loopback::new();
-    let mut device = EthernetTracer::new(device, |_timestamp, printer| trace!("{}", printer));
-
-    #[cfg(feature = "std")]
-    let mut device = {
         let (mut opts, mut free) = utils::create_options();
         utils::add_middleware_options(&mut opts, &mut free);