From e0594712359835823571ffacd87d7167edb51716 Mon Sep 17 00:00:00 2001 From: Marcel Kummer Date: Mon, 27 Nov 2023 20:56:12 +0100 Subject: [PATCH] Remove commented code + make expectations clear --- escl-scan/src/scannerfinder.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/escl-scan/src/scannerfinder.rs b/escl-scan/src/scannerfinder.rs index d755cc9..f6455e6 100644 --- a/escl-scan/src/scannerfinder.rs +++ b/escl-scan/src/scannerfinder.rs @@ -26,7 +26,6 @@ pub struct ScannerFinder { impl ScannerFinder { pub fn new() -> ScannerFinder { - //ScannerFinder { scanners: vec![] } ScannerFinder { scanners: Arc::new(Mutex::new(vec![])), } @@ -50,8 +49,6 @@ impl ScannerFinder { let mut browser = MdnsBrowser::new(service_type); browser.set_service_discovered_callback(Box::new(Self::on_service_discovered)); - - //let scanners: Arc>> = Arc::new(Mutex::new(vec![])); browser.set_context(Box::new(Arc::clone(&self.scanners))); let event_loop = match browser.browse_services() { @@ -98,12 +95,11 @@ impl ScannerFinder { }; log::info!("Service discovered: {service:?}",); - //let mut context = context.expect("We provided a scanner list as context"); let scanners = context .as_ref() - .unwrap() + .expect("Context was passed to on_service_discovered") .downcast_ref::>>>() - .unwrap(); + .expect("context can be downcasted to Arc>>"); let mut scanners = scanners.lock().unwrap(); let txt: &TxtRecord = match service.txt() {