diff --git a/src/nodes/beam_splitter.rs b/src/nodes/beam_splitter.rs index 772d63d8559a6c8806342bc4c6a58c1e5f61c6d8..120750e5fd3a724ccd00f17fcaf7c5905f81515a 100644 --- a/src/nodes/beam_splitter.rs +++ b/src/nodes/beam_splitter.rs @@ -105,7 +105,11 @@ impl BeamSplitter { s.scale_vertical(1.0 - self.ratio()).unwrap(); out1_2_spectrum = Some(s); } - _ => return Err(OpossumError::Analysis("expected DataEnergy value at input port".into())), + _ => { + return Err(OpossumError::Analysis( + "expected DataEnergy value at input port".into(), + )) + } } } if let Some(Some(in2)) = in2 { @@ -118,7 +122,11 @@ impl BeamSplitter { s.scale_vertical(1.0 - self.ratio()).unwrap(); out2_2_spectrum = Some(s); } - _ => return Err(OpossumError::Analysis("expected DataEnergy value at input port".into())), + _ => { + return Err(OpossumError::Analysis( + "expected DataEnergy value at input port".into(), + )) + } } } let out1_spec = merge_spectra(out1_1_spectrum, out2_2_spectrum); diff --git a/src/nodes/energy_meter.rs b/src/nodes/energy_meter.rs index 7ab49faed8fb857eb5a0b298479bed42f2230f72..cad23adc35365e8c3ce5f7db34ef0a97f62fbb37 100644 --- a/src/nodes/energy_meter.rs +++ b/src/nodes/energy_meter.rs @@ -208,32 +208,27 @@ mod test { fn analyze() { let mut meter = EnergyMeter::default(); let mut input = LightResult::default(); - let input_data=Some(LightData::Energy(DataEnergy { + let input_data = Some(LightData::Energy(DataEnergy { spectrum: create_he_ne_spectrum(1.0), })); - input.insert( - "in1".into(), - input_data.clone(), - ); + input.insert("in1".into(), input_data.clone()); let result = meter.analyze(input, &AnalyzerType::Energy); assert!(result.is_ok()); assert!(result.clone().unwrap().contains_key("out1")); - assert!(result.unwrap().get("out1").unwrap().is_some()); + assert_eq!(result.unwrap().get("out1").unwrap(), &input_data); } #[test] fn analyze_inverted() { let mut meter = EnergyMeter::default(); let mut input = LightResult::default(); meter.set_property("inverted", true.into()).unwrap(); - input.insert( - "out1".into(), - Some(LightData::Energy(DataEnergy { - spectrum: create_he_ne_spectrum(1.0), - })), - ); + let input_data = Some(LightData::Energy(DataEnergy { + spectrum: create_he_ne_spectrum(1.0), + })); + input.insert("out1".into(), input_data.clone()); let result = meter.analyze(input, &AnalyzerType::Energy); assert!(result.is_ok()); assert!(result.clone().unwrap().contains_key("in1")); - assert!(result.unwrap().get("in1").unwrap().is_some()); + assert_eq!(result.unwrap().get("in1").unwrap(), &input_data); } }