Merge pull request #32 from Atul9/cargo-fmt

Format code using 'cargo fmt'
This commit is contained in:
kennytm 2019-08-17 14:35:38 +08:00 committed by GitHub
commit 6323585a35
3 changed files with 11 additions and 12 deletions

View file

@ -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")
}

View file

@ -332,9 +332,7 @@ impl<I: Iterator<Item = Segment>> Iterator for Optimizer<I> {
/// 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")]

View file

@ -20,10 +20,10 @@ macro_rules! impl_pixel_for_image_pixel {
};
}
impl_pixel_for_image_pixel!{ Luma<S>: p => [p] }
impl_pixel_for_image_pixel!{ LumaA<S>: p => [p, S::max_value()] }
impl_pixel_for_image_pixel!{ Rgb<S>: p => [p, p, p] }
impl_pixel_for_image_pixel!{ Rgba<S>: p => [p, p, p, S::max_value()] }
impl_pixel_for_image_pixel! { Luma<S>: p => [p] }
impl_pixel_for_image_pixel! { LumaA<S>: p => [p, S::max_value()] }
impl_pixel_for_image_pixel! { Rgb<S>: p => [p, p, p] }
impl_pixel_for_image_pixel! { Rgba<S>: p => [p, p, p, S::max_value()] }
impl<P: ImagePixel + 'static> Canvas for (P, ImageBuffer<P, Vec<P::Subpixel>>) {
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)]