From e3e2273e07df84fbc510200f108a6d39125cf629 Mon Sep 17 00:00:00 2001 From: Atul Bhosale Date: Tue, 13 Aug 2019 00:06:49 +0530 Subject: [PATCH] Format code using 'cargo fmt' --- src/canvas.rs | 7 ++++--- src/optimize.rs | 5 +---- src/render/image.rs | 11 ++++++----- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/canvas.rs b/src/canvas.rs index c66075e..cf9ea11 100644 --- a/src/canvas.rs +++ b/src/canvas.rs @@ -1124,7 +1124,6 @@ mod all_functional_patterns_tests { assert!(is_functional(version, version.width(), 0, 9)); assert!(!is_functional(version, version.width(), 1, 9)); } - } //}}} @@ -1978,11 +1977,13 @@ impl Canvas { match self.version { Version::Normal(_) => ALL_PATTERNS_QR.iter(), Version::Micro(_) => ALL_PATTERNS_MICRO_QR.iter(), - }.map(|ptn| { + } + .map(|ptn| { let mut c = self.clone(); c.apply_mask(*ptn); c - }).min_by_key(Self::compute_total_penalty_scores) + }) + .min_by_key(Self::compute_total_penalty_scores) .expect("at least one pattern") } diff --git a/src/optimize.rs b/src/optimize.rs index bceca6a..bf154dc 100644 --- a/src/optimize.rs +++ b/src/optimize.rs @@ -332,9 +332,7 @@ impl> Iterator for Optimizer { /// Computes the total encoded length of all segments. pub fn total_encoded_len(segments: &[Segment], version: Version) -> usize { - segments.iter() - .map(|seg| seg.encoded_len(version)) - .sum() + segments.iter().map(|seg| seg.encoded_len(version)).sum() } #[cfg(test)] @@ -453,7 +451,6 @@ mod optimize_tests { Version::Micro(3), ); } - } #[cfg(feature = "bench")] diff --git a/src/render/image.rs b/src/render/image.rs index 31d6a41..878e8f7 100644 --- a/src/render/image.rs +++ b/src/render/image.rs @@ -20,10 +20,10 @@ macro_rules! impl_pixel_for_image_pixel { }; } -impl_pixel_for_image_pixel!{ Luma: p => [p] } -impl_pixel_for_image_pixel!{ LumaA: p => [p, S::max_value()] } -impl_pixel_for_image_pixel!{ Rgb: p => [p, p, p] } -impl_pixel_for_image_pixel!{ Rgba: p => [p, p, p, S::max_value()] } +impl_pixel_for_image_pixel! { Luma: p => [p] } +impl_pixel_for_image_pixel! { LumaA: p => [p, S::max_value()] } +impl_pixel_for_image_pixel! { Rgb: p => [p, p, p] } +impl_pixel_for_image_pixel! { Rgba: p => [p, p, p, S::max_value()] } impl Canvas for (P, ImageBuffer>) { type Pixel = P; @@ -66,7 +66,8 @@ mod render_tests { ], 3, 1, - ).module_dimensions(1, 1) + ) + .module_dimensions(1, 1) .build(); #[cfg_attr(rustfmt, rustfmt_skip)]