From 914b67a211942c206b6bdf3ecb62c9efa192e478 Mon Sep 17 00:00:00 2001 From: Thomas Knudsen Date: Fri, 3 May 2024 11:42:59 +0200 Subject: [PATCH 1/5] Silence a new clippy warning 'assigning the result of `Clone::clone()` may be inefficient' --- src/grid/ntv2/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/grid/ntv2/mod.rs b/src/grid/ntv2/mod.rs index a1da29d..801fd2a 100644 --- a/src/grid/ntv2/mod.rs +++ b/src/grid/ntv2/mod.rs @@ -89,7 +89,7 @@ impl Ntv2Grid { current_grid_id = grid_id.clone(); if let Some(children) = self.lookup_table.get(¤t_grid_id) { - queue = children.clone(); + queue.clone_from(children); } else { // If we get here it means the current_parent_id has no children and we've found the grid break; From b4c140539f6edc6e2732814b5902346f495db16e Mon Sep 17 00:00:00 2001 From: Thomas Knudsen Date: Fri, 3 May 2024 11:47:09 +0200 Subject: [PATCH 2/5] another --- src/grid/ntv2/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/grid/ntv2/mod.rs b/src/grid/ntv2/mod.rs index 801fd2a..acffe80 100644 --- a/src/grid/ntv2/mod.rs +++ b/src/grid/ntv2/mod.rs @@ -86,7 +86,7 @@ impl Ntv2Grid { continue; } - current_grid_id = grid_id.clone(); + current_grid_id.clone_from(&grid_id); if let Some(children) = self.lookup_table.get(¤t_grid_id) { queue.clone_from(children); From d9e9192ddcce2f05b22a486dc9c152aa4528f145 Mon Sep 17 00:00:00 2001 From: Thomas Knudsen Date: Fri, 3 May 2024 11:49:58 +0200 Subject: [PATCH 3/5] another another --- src/bin/kp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/kp.rs b/src/bin/kp.rs index 9e03e20..471d8a8 100644 --- a/src/bin/kp.rs +++ b/src/bin/kp.rs @@ -185,7 +185,7 @@ fn transform( // to compute the roundtrip differences let mut buffer = Vec::new(); if options.roundtrip { - buffer = operands.clone(); + buffer.clone_from(&operands); } let mut n = if options.inverse { From ea3294cc73da8b15de1857516433415e953363a4 Mon Sep 17 00:00:00 2001 From: Thomas Knudsen Date: Fri, 3 May 2024 11:53:01 +0200 Subject: [PATCH 4/5] aaanother --- src/bin/kp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/kp.rs b/src/bin/kp.rs index 471d8a8..71072d4 100644 --- a/src/bin/kp.rs +++ b/src/bin/kp.rs @@ -185,7 +185,7 @@ fn transform( // to compute the roundtrip differences let mut buffer = Vec::new(); if options.roundtrip { - buffer.clone_from(&operands); + buffer.clone_from(operands); } let mut n = if options.inverse { From 451483756299a841c350b7d8b4ff8915b6ae1ec4 Mon Sep 17 00:00:00 2001 From: Thomas Knudsen Date: Fri, 3 May 2024 12:01:38 +0200 Subject: [PATCH 5/5] again --- src/grid/ntv2/mod.rs | 2 +- src/op/parsed_parameters.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/grid/ntv2/mod.rs b/src/grid/ntv2/mod.rs index acffe80..83627f8 100644 --- a/src/grid/ntv2/mod.rs +++ b/src/grid/ntv2/mod.rs @@ -207,7 +207,7 @@ mod tests { .contains(&"5458".to_string())); // Grids with no children do not appear in the lookup table - assert!(ntv2_grid.lookup_table.get("5556").is_none()); + assert!(!ntv2_grid.lookup_table.contains_key("5556")); Ok(()) } diff --git a/src/op/parsed_parameters.rs b/src/op/parsed_parameters.rs index 6e850af..0e67ecf 100644 --- a/src/op/parsed_parameters.rs +++ b/src/op/parsed_parameters.rs @@ -535,12 +535,12 @@ mod tests { // Booleans correctly parsed? assert!( - p.boolean.get("flag").is_some(), + p.boolean.contains("flag"), "`flag` not in registered booleans: {:#?}", p.boolean ); assert!( - p.boolean.get("galf").is_none(), + !p.boolean.contains("galf"), "`galf` not in registered booleans: {:?}", p.boolean );