diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml index bf4cbb5845..4356b8eaae 100644 --- a/.github/workflows/rust.yaml +++ b/.github/workflows/rust.yaml @@ -38,6 +38,12 @@ jobs: command: fmt args: -- --check + - uses: actions-rs/cargo@v1 + name: Lint Check + with: + command: clippy + args: --all-features --all-targets -- -D warnings + test: name: Tests runs-on: ubuntu-latest diff --git a/generator/sbpg/targets/resources/rust/test/sbp_tests_main_template.rs b/generator/sbpg/targets/resources/rust/test/sbp_tests_main_template.rs index eda1e714a6..41b47b7320 100644 --- a/generator/sbpg/targets/resources/rust/test/sbp_tests_main_template.rs +++ b/generator/sbpg/targets/resources/rust/test/sbp_tests_main_template.rs @@ -11,6 +11,8 @@ // This file was auto-generated. Do not modify by hand! +#![allow(clippy::excessive_precision)] + ((*- for test_name in test_names *)) mod (((test_name))); ((*- endfor *)) diff --git a/generator/sbpg/targets/test_rust.py b/generator/sbpg/targets/test_rust.py index 536a926322..16ee2d03ce 100644 --- a/generator/sbpg/targets/test_rust.py +++ b/generator/sbpg/targets/test_rust.py @@ -23,7 +23,7 @@ TEST_MAIN_TEMPLATE_NAME = "rust/test/sbp_tests_main_template.rs" def str_escape(value): - return "\"{}\".to_string()".format(value) + return "\"{}\"".format(value) def mod_name(value): return value.split('.')[1] diff --git a/rust/sbp/src/de.rs b/rust/sbp/src/de.rs index 04a3046ba5..e20951cc31 100644 --- a/rust/sbp/src/de.rs +++ b/rust/sbp/src/de.rs @@ -182,7 +182,7 @@ impl futures::Stream for Decoder { ) -> std::task::Poll> { let frame = match futures::ready!(std::pin::Pin::new(&mut self.0).poll_next(cx)) { Some(Ok(frame)) => frame, - Some(Err(e)) => return std::task::Poll::Ready(Some(Err(e.into()))), + Some(Err(e)) => return std::task::Poll::Ready(Some(Err(e))), None => return std::task::Poll::Ready(None), }; std::task::Poll::Ready(Some(frame.to_sbp())) @@ -346,7 +346,7 @@ impl futures::Stream for TimeoutDecoder { ) -> std::task::Poll> { match futures::ready!(std::pin::Pin::new(&mut self.0).poll_next(cx)) { Some(Ok(frame)) => std::task::Poll::Ready(Some(frame.to_sbp())), - Some(Err(e)) => std::task::Poll::Ready(Some(Err(e.into()))), + Some(Err(e)) => std::task::Poll::Ready(Some(Err(e))), None => std::task::Poll::Ready(None), } } @@ -381,10 +381,7 @@ mod tests { let timeout_duration = Duration::from_secs(2); let now = Instant::now(); let mut messages = iter_messages_with_timeout(rdr, timeout_duration); - for msg in &mut messages { - assert!(matches!(msg, Err(Error::IoError(_)))); - break; - } + assert!(matches!(messages.next().unwrap(), Err(Error::IoError(_)))); assert!(now.elapsed() >= timeout_duration); } diff --git a/rust/sbp/src/link.rs b/rust/sbp/src/link.rs index 739344f0f6..15b89c9118 100644 --- a/rust/sbp/src/link.rs +++ b/rust/sbp/src/link.rs @@ -49,7 +49,7 @@ where { let mut handlers = self.link.inner.handlers.lock().unwrap(); for handler in handlers.values_mut() { - if handler.can_run(&msg) { + if handler.can_run(msg) { handler.run(state, msg.clone()); sent = true; } @@ -58,7 +58,7 @@ where { let mut handlers = self.stateless_link.inner.handlers.lock().unwrap(); for handler in handlers.values_mut() { - if handler.can_run(&msg) { + if handler.can_run(msg) { handler.run(&(), msg.clone()); sent = true; } @@ -142,6 +142,7 @@ struct LinkInner<'link, S> { } /// A message handler and the message ids it responds to. +#[allow(clippy::type_complexity)] pub struct Handler<'link, S> { func: Box, msg_types: Cow<'static, [u16]>, @@ -225,7 +226,7 @@ slotmap::new_key_type! { } /// Returned when registering a callback. Can be used to unregister the callback. -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct Key { key: KeyInner, } diff --git a/rust/sbp/src/sbp_iter_ext.rs b/rust/sbp/src/sbp_iter_ext.rs index 06decc6152..c14c1dc097 100644 --- a/rust/sbp/src/sbp_iter_ext.rs +++ b/rust/sbp/src/sbp_iter_ext.rs @@ -232,17 +232,17 @@ mod tests { let mut with_time = iter_messages(data).ignore_errors().with_rover_time(); - let gps_time = with_time.next().map(|(_, t)| t).flatten().unwrap().unwrap(); + let gps_time = with_time.next().and_then(|(_, t)| t).unwrap().unwrap(); assert_eq!(gps_time.wn(), 1787); assert!((gps_time.tow() - 2567.8).abs() < f64::EPSILON); - assert!(with_time.next().map(|(_, t)| t).flatten().is_none()); + assert!(with_time.next().and_then(|(_, t)| t).is_none()); - let gps_time = with_time.next().map(|(_, t)| t).flatten().unwrap().unwrap(); + let gps_time = with_time.next().and_then(|(_, t)| t).unwrap().unwrap(); assert_eq!(gps_time.wn(), 1787); assert!((gps_time.tow() - 2567.9).abs() < f64::EPSILON); - let gps_time = with_time.next().map(|(_, t)| t).flatten().unwrap().unwrap(); + let gps_time = with_time.next().and_then(|(_, t)| t).unwrap().unwrap(); assert_eq!(gps_time.wn(), 1787); assert!((gps_time.tow() - 2568.).abs() < f64::EPSILON); } diff --git a/rust/sbp/src/sbp_string.rs b/rust/sbp/src/sbp_string.rs index 94df3fa092..75d5078fbd 100644 --- a/rust/sbp/src/sbp_string.rs +++ b/rust/sbp/src/sbp_string.rs @@ -487,7 +487,7 @@ mod tests { // Auto generate alternating bytes [`from_parts`] section // ----- let parts = ["a", "b", "c"]; - let multipart = SbpString::<_, Multipart>::from_parts(&parts); + let multipart = SbpString::<_, Multipart>::from_parts(parts); assert_eq!(multipart.data, null); // Test [`parts`] section @@ -525,7 +525,7 @@ mod tests { // Auto generate alternating bytes [`from_parts`] section // ----- let parts = ["a", "b", "c"]; - let double_null = SbpString::<_, DoubleNullTerminated>::from_parts(&parts); + let double_null = SbpString::<_, DoubleNullTerminated>::from_parts(parts); assert_eq!(double_null.data, data); // Test [`parts`] section diff --git a/rust/sbp/tests/integration/auto_check_sbp_bootload_msg_bootloader_handshake_resp.rs b/rust/sbp/tests/integration/auto_check_sbp_bootload_msg_bootloader_handshake_resp.rs index b2781096b8..18a680afea 100644 --- a/rust/sbp/tests/integration/auto_check_sbp_bootload_msg_bootloader_handshake_resp.rs +++ b/rust/sbp/tests/integration/auto_check_sbp_bootload_msg_bootloader_handshake_resp.rs @@ -54,12 +54,10 @@ fn test_auto_check_sbp_bootload_msg_bootloader_handshake_resp() { assert_eq!( msg.version.to_string(), "v1.2 -" - .to_string(), +", "incorrect value for msg.version, expected string '{}', is '{}'", "v1.2 -" - .to_string(), +", msg.version ); } @@ -173,12 +171,10 @@ fn test_json2sbp_auto_check_sbp_bootload_msg_bootloader_handshake_resp() { assert_eq!( msg.version.to_string(), "v1.2 -" - .to_string(), +", "incorrect value for msg.version, expected string '{}', is '{}'", "v1.2 -" - .to_string(), +", msg.version ); } @@ -308,12 +304,10 @@ fn test_sbp2json_auto_check_sbp_bootload_msg_bootloader_handshake_resp() { assert_eq!( msg.version.to_string(), "v1.2 -" - .to_string(), +", "incorrect value for msg.version, expected string '{}', is '{}'", "v1.2 -" - .to_string(), +", msg.version ); } diff --git a/rust/sbp/tests/integration/auto_check_sbp_logging_msg_log.rs b/rust/sbp/tests/integration/auto_check_sbp_logging_msg_log.rs index 88ffb00f56..60f3655255 100644 --- a/rust/sbp/tests/integration/auto_check_sbp_logging_msg_log.rs +++ b/rust/sbp/tests/integration/auto_check_sbp_logging_msg_log.rs @@ -55,9 +55,9 @@ fn test_auto_check_sbp_logging_msg_log() { ); assert_eq!( msg.text.to_string(), - "Filtered all obs from 2314 at tow 83.539019".to_string(), + "Filtered all obs from 2314 at tow 83.539019", "incorrect value for msg.text, expected string '{}', is '{}'", - "Filtered all obs from 2314 at tow 83.539019".to_string(), + "Filtered all obs from 2314 at tow 83.539019", msg.text ); } @@ -120,9 +120,9 @@ fn test_json2sbp_auto_check_sbp_logging_msg_log() { ); assert_eq!( msg.text.to_string(), - "Filtered all obs from 2314 at tow 83.539019".to_string(), + "Filtered all obs from 2314 at tow 83.539019", "incorrect value for msg.text, expected string '{}', is '{}'", - "Filtered all obs from 2314 at tow 83.539019".to_string(), + "Filtered all obs from 2314 at tow 83.539019", msg.text ); } @@ -194,9 +194,9 @@ fn test_sbp2json_auto_check_sbp_logging_msg_log() { ); assert_eq!( msg.text.to_string(), - "Filtered all obs from 2314 at tow 83.539019".to_string(), + "Filtered all obs from 2314 at tow 83.539019", "incorrect value for msg.text, expected string '{}', is '{}'", - "Filtered all obs from 2314 at tow 83.539019".to_string(), + "Filtered all obs from 2314 at tow 83.539019", msg.text ); } diff --git a/rust/sbp/tests/integration/auto_check_sbp_logging_msg_print_dep.rs b/rust/sbp/tests/integration/auto_check_sbp_logging_msg_print_dep.rs index 1d76cea9e9..d505978cce 100644 --- a/rust/sbp/tests/integration/auto_check_sbp_logging_msg_print_dep.rs +++ b/rust/sbp/tests/integration/auto_check_sbp_logging_msg_print_dep.rs @@ -51,12 +51,10 @@ fn test_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: acq: PRN 15 found @ -2497 Hz, 20 SNR -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: acq: PRN 15 found @ -2497 Hz, 20 SNR -" - .to_string(), +", msg.text ); } @@ -96,12 +94,10 @@ fn test_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: acq: PRN 31 found @ 4245 Hz, 21 SNR -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: acq: PRN 31 found @ 4245 Hz, 21 SNR -" - .to_string(), +", msg.text ); } @@ -141,12 +137,10 @@ fn test_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: Disabling channel 0 (PRN 11) -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: Disabling channel 0 (PRN 11) -" - .to_string(), +", msg.text ); } @@ -186,12 +180,10 @@ fn test_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: acq: PRN 2 found @ 3996 Hz, 20 SNR -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: acq: PRN 2 found @ 3996 Hz, 20 SNR -" - .to_string(), +", msg.text ); } @@ -231,12 +223,10 @@ fn test_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: acq: PRN 4 found @ -7492 Hz, 20 SNR -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: acq: PRN 4 found @ -7492 Hz, 20 SNR -" - .to_string(), +", msg.text ); } @@ -276,12 +266,10 @@ fn test_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: Disabling channel 1 (PRN 15) -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: Disabling channel 1 (PRN 15) -" - .to_string(), +", msg.text ); } @@ -340,12 +328,10 @@ fn test_json2sbp_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: acq: PRN 15 found @ -2497 Hz, 20 SNR -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: acq: PRN 15 found @ -2497 Hz, 20 SNR -" - .to_string(), +", msg.text ); } @@ -390,12 +376,10 @@ fn test_json2sbp_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: acq: PRN 31 found @ 4245 Hz, 21 SNR -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: acq: PRN 31 found @ 4245 Hz, 21 SNR -" - .to_string(), +", msg.text ); } @@ -440,12 +424,10 @@ fn test_json2sbp_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: Disabling channel 0 (PRN 11) -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: Disabling channel 0 (PRN 11) -" - .to_string(), +", msg.text ); } @@ -490,12 +472,10 @@ fn test_json2sbp_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: acq: PRN 2 found @ 3996 Hz, 20 SNR -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: acq: PRN 2 found @ 3996 Hz, 20 SNR -" - .to_string(), +", msg.text ); } @@ -540,12 +520,10 @@ fn test_json2sbp_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: acq: PRN 4 found @ -7492 Hz, 20 SNR -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: acq: PRN 4 found @ -7492 Hz, 20 SNR -" - .to_string(), +", msg.text ); } @@ -590,12 +568,10 @@ fn test_json2sbp_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: Disabling channel 1 (PRN 15) -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: Disabling channel 1 (PRN 15) -" - .to_string(), +", msg.text ); } @@ -663,12 +639,10 @@ fn test_sbp2json_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: acq: PRN 15 found @ -2497 Hz, 20 SNR -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: acq: PRN 15 found @ -2497 Hz, 20 SNR -" - .to_string(), +", msg.text ); } @@ -727,12 +701,10 @@ fn test_sbp2json_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: acq: PRN 31 found @ 4245 Hz, 21 SNR -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: acq: PRN 31 found @ 4245 Hz, 21 SNR -" - .to_string(), +", msg.text ); } @@ -791,12 +763,10 @@ fn test_sbp2json_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: Disabling channel 0 (PRN 11) -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: Disabling channel 0 (PRN 11) -" - .to_string(), +", msg.text ); } @@ -855,12 +825,10 @@ fn test_sbp2json_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: acq: PRN 2 found @ 3996 Hz, 20 SNR -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: acq: PRN 2 found @ 3996 Hz, 20 SNR -" - .to_string(), +", msg.text ); } @@ -919,12 +887,10 @@ fn test_sbp2json_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: acq: PRN 4 found @ -7492 Hz, 20 SNR -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: acq: PRN 4 found @ -7492 Hz, 20 SNR -" - .to_string(), +", msg.text ); } @@ -983,12 +949,10 @@ fn test_sbp2json_auto_check_sbp_logging_msg_print_dep() { assert_eq!( msg.text.to_string(), "INFO: Disabling channel 1 (PRN 15) -" - .to_string(), +", "incorrect value for msg.text, expected string '{}', is '{}'", "INFO: Disabling channel 1 (PRN 15) -" - .to_string(), +", msg.text ); } diff --git a/rust/sbp/tests/integration/auto_check_sbp_navigation_msg_reference_frame_param.rs b/rust/sbp/tests/integration/auto_check_sbp_navigation_msg_reference_frame_param.rs index 1b9d62f659..5a1e00914e 100644 Binary files a/rust/sbp/tests/integration/auto_check_sbp_navigation_msg_reference_frame_param.rs and b/rust/sbp/tests/integration/auto_check_sbp_navigation_msg_reference_frame_param.rs differ diff --git a/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_network_bandwidth_usage.rs b/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_network_bandwidth_usage.rs index 3bee6f9bf2..caea536ebd 100644 Binary files a/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_network_bandwidth_usage.rs and b/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_network_bandwidth_usage.rs differ diff --git a/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_thread_state.rs b/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_thread_state.rs index cb87708b0f..5489cef27c 100644 Binary files a/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_thread_state.rs and b/rust/sbp/tests/integration/auto_check_sbp_piksi_msg_thread_state.rs differ diff --git a/rust/sbp/tests/integration/auto_check_sbp_settings_msg_settings_read_by_index_resp.rs b/rust/sbp/tests/integration/auto_check_sbp_settings_msg_settings_read_by_index_resp.rs index 8f96eb2598..f41be53ea7 100644 Binary files a/rust/sbp/tests/integration/auto_check_sbp_settings_msg_settings_read_by_index_resp.rs and b/rust/sbp/tests/integration/auto_check_sbp_settings_msg_settings_read_by_index_resp.rs differ diff --git a/rust/sbp/tests/integration/auto_check_sbp_system_msg_dgnss_status.rs b/rust/sbp/tests/integration/auto_check_sbp_system_msg_dgnss_status.rs index fc02f2f4b3..11c9c18bc3 100644 --- a/rust/sbp/tests/integration/auto_check_sbp_system_msg_dgnss_status.rs +++ b/rust/sbp/tests/integration/auto_check_sbp_system_msg_dgnss_status.rs @@ -63,9 +63,9 @@ fn test_auto_check_sbp_system_msg_dgnss_status() { ); assert_eq!( msg.source.to_string(), - "Skylark".to_string(), + "Skylark", "incorrect value for msg.source, expected string '{}', is '{}'", - "Skylark".to_string(), + "Skylark", msg.source ); } @@ -138,9 +138,9 @@ fn test_json2sbp_auto_check_sbp_system_msg_dgnss_status() { ); assert_eq!( msg.source.to_string(), - "Skylark".to_string(), + "Skylark", "incorrect value for msg.source, expected string '{}', is '{}'", - "Skylark".to_string(), + "Skylark", msg.source ); } @@ -220,9 +220,9 @@ fn test_sbp2json_auto_check_sbp_system_msg_dgnss_status() { ); assert_eq!( msg.source.to_string(), - "Skylark".to_string(), + "Skylark", "incorrect value for msg.source, expected string '{}', is '{}'", - "Skylark".to_string(), + "Skylark", msg.source ); } diff --git a/rust/sbp/tests/integration/main.rs b/rust/sbp/tests/integration/main.rs index d883296a15..22cdb1e432 100644 --- a/rust/sbp/tests/integration/main.rs +++ b/rust/sbp/tests/integration/main.rs @@ -10,6 +10,8 @@ // WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. // This file was auto-generated. Do not modify by hand! + +#![allow(clippy::excessive_precision)] mod auto_check_sbp_acquisition_msg_acq_result_dep_a; mod auto_check_sbp_acquisition_msg_acq_result_dep_b; mod auto_check_sbp_acquisition_msg_acq_result_dep_c; diff --git a/rust/sbp2json/tests/common/mod.rs b/rust/sbp2json/tests/common/mod.rs index 1fe379a43a..4e734c304c 100644 --- a/rust/sbp2json/tests/common/mod.rs +++ b/rust/sbp2json/tests/common/mod.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + use std::{ env, fs::{self, File}, @@ -65,7 +67,7 @@ pub fn find_project_root() -> Option { break; } } - return None; + None } pub struct DeleteTestOutput { @@ -91,8 +93,8 @@ impl DeleteTestOutput { pub fn new() -> DeleteTestOutput { DeleteTestOutput { files: vec![] } } - pub fn add_test_output(&mut self, file_path: &PathBuf) { - self.files.push(file_path.clone()); + pub fn add_test_output(&mut self, file_path: &Path) { + self.files.push(file_path.to_path_buf()); } } @@ -194,8 +196,8 @@ fn file_equals>(input: P, output: P, json: bool) -> bool { eprintln!("input: {:?}, output: {:?}", &input_path, &output_path); - let input_file = File::open(&input_path).unwrap(); - let output_file = File::open(&output_path).unwrap(); + let input_file = File::open(input_path).unwrap(); + let output_file = File::open(output_path).unwrap(); if json { json_file_equals(input_file, output_file) diff --git a/rust/sbp2json/tests/test_error.rs b/rust/sbp2json/tests/test_error.rs index 0a178e615d..444e552303 100644 --- a/rust/sbp2json/tests/test_error.rs +++ b/rust/sbp2json/tests/test_error.rs @@ -1,7 +1,6 @@ mod common; -use crate::common::{data_path, find_project_root}; -use assert_cmd::cargo::CommandCargoExt; +use crate::common::data_path; use assert_cmd::Command; /// Asserts termination of json decoder on broken inputs diff --git a/rust/sbp2json/tests/test_round_trips.rs b/rust/sbp2json/tests/test_round_trips.rs index 9b1013601c..0675405e5e 100644 --- a/rust/sbp2json/tests/test_round_trips.rs +++ b/rust/sbp2json/tests/test_round_trips.rs @@ -43,7 +43,7 @@ fn test_continue_on_error() { #[test] fn test_sbp2json() { let tranform1 = |reader, writer| run_sbp2json(reader, writer, true); - let tranform2 = |reader, writer| run_json2sbp(reader, writer); + let tranform2 = run_json2sbp; test_round_trip( tranform1, @@ -57,7 +57,7 @@ fn test_sbp2json() { #[test] fn test_json2sbp() { - let tranform1 = |reader, writer| run_json2sbp(reader, writer); + let tranform1 = run_json2sbp; let tranform2 = |reader, writer| run_sbp2json(reader, writer, true); test_round_trip( @@ -72,7 +72,7 @@ fn test_json2sbp() { #[test] fn test_jsonfields2sbp() { - let tranform1 = |reader, writer| run_jsonfields2sbp(reader, writer); + let tranform1 = run_jsonfields2sbp; let tranform2 = |reader, writer| run_sbp2json(reader, writer, false); test_round_trip( @@ -87,8 +87,8 @@ fn test_jsonfields2sbp() { #[test] fn test_json2json() { - let tranform1 = |reader, writer| run_json2json(reader, writer); - let tranform2 = |reader, writer| run_json2sbp(reader, writer); + let tranform1 = run_json2json; + let tranform2 = run_json2sbp; let third_transform = ThirdTransform { transform: |reader, writer| run_sbp2json(reader, writer, true),