Skip to content

Commit 0a808e0

Browse files
committed
fmt
1 parent 3b58449 commit 0a808e0

File tree

15 files changed

+30
-55
lines changed

15 files changed

+30
-55
lines changed

imagequant-sys/build.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
fn main() {
32
println!("cargo:include={}", std::env::var("CARGO_MANIFEST_DIR").unwrap());
43
}

imagequant-sys/src/ffi.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ use imagequant::capi::*;
1212
use imagequant::Error::LIQ_OK;
1313
use imagequant::*;
1414
use std::ffi::CString;
15-
use std::mem::ManuallyDrop;
16-
use std::mem::MaybeUninit;
17-
use std::os::raw::c_char;
18-
use std::os::raw::{c_int, c_uint, c_void};
15+
use std::mem::{ManuallyDrop, MaybeUninit};
16+
use std::os::raw::{c_char, c_int, c_uint, c_void};
1917
use std::ptr;
2018

2119
pub use imagequant::Error as liq_error;

src/attr.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use crate::error::Error;
22
use crate::hist::Histogram;
33
use crate::image::Image;
4-
use crate::pal::PalLen;
5-
use crate::pal::MAX_COLORS;
6-
use crate::pal::RGBA;
4+
use crate::pal::{PalLen, MAX_COLORS, RGBA};
75
use crate::quant::{mse_to_quality, quality_to_mse, QuantizationResult};
86
use crate::remap::DitherMapMode;
97
use std::sync::Arc;

src/capi.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
#![allow(clippy::missing_safety_doc)]
55

66
use crate::rows::RowCallback;
7-
use crate::seacow::Pointer;
8-
use crate::seacow::RowBitmapMut;
9-
use crate::seacow::SeaCow;
107
use crate::Attributes;
118
use crate::Error;
129
use crate::Image;
1310
use crate::pal::Palette;
1411
use crate::QuantizationResult;
1512
use crate::RGBA;
13+
use crate::seacow::{Pointer, RowBitmapMut, SeaCow};
1614
use std::mem::MaybeUninit;
1715

1816
pub const LIQ_VERSION: u32 = 40202;

src/hist.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
use crate::error::*;
22
use crate::image::Image;
3-
use crate::pal::PalIndex;
4-
use crate::pal::ARGBF;
5-
use crate::pal::MAX_COLORS;
6-
use crate::pal::{f_pixel, gamma_lut, RGBA};
3+
use crate::pal::{f_pixel, gamma_lut, PalIndex, ARGBF, MAX_COLORS, RGBA};
74
use crate::quant::QuantizationResult;
8-
use crate::rows::temp_buf;
9-
use crate::rows::DynamicRows;
5+
use crate::rows::{temp_buf, DynamicRows};
106
use crate::Attributes;
117
use std::collections::{HashMap, HashSet};
128
use std::fmt;
@@ -387,6 +383,7 @@ pub(crate) struct Cluster {
387383
// Simple deterministic hasher for the color hashmap
388384
impl std::hash::BuildHasher for U32Hasher {
389385
type Hasher = Self;
386+
390387
#[inline(always)]
391388
fn build_hasher(&self) -> Self {
392389
Self(0)

src/image.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ use crate::error::*;
44
use crate::pal::{f_pixel, PalF, PalIndexRemap, MAX_COLORS, MIN_OPAQUE_A, RGBA};
55
use crate::remap::DitherMapMode;
66
use crate::rows::{DynamicRows, PixelsSource};
7-
use crate::seacow::RowBitmap;
8-
use crate::seacow::SeaCow;
97
use crate::PushInCapacity;
108
use crate::LIQ_HIGH_MEMORY_LIMIT;
9+
use crate::seacow::{RowBitmap, SeaCow};
1110
use rgb::prelude::*;
1211
use std::mem::MaybeUninit;
1312

@@ -336,7 +335,7 @@ impl<'pixels> Image<'pixels> {
336335
Ok(p) => p,
337336
Err(e) => {
338337
attr.verbose_print(format!("Buffer length is {} bytes, which is not enough for {}×{}×4 RGBA bytes", pixels_len*4, stride, height));
339-
return Err(e)
338+
return Err(e);
340339
},
341340
};
342341
Image::new_internal(attr, pixels_rows, width, height, gamma)

src/lib.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ pub(crate) struct CacheLineAlign<T>(pub T);
5151
#[cfg(feature = "_internal_c_ffi")]
5252
pub mod capi;
5353

54-
pub use attr::Attributes;
55-
pub use attr::ControlFlow;
54+
pub use attr::{Attributes, ControlFlow};
5655
pub use error::Error;
57-
pub use hist::Histogram;
58-
pub use hist::HistogramEntry;
56+
pub use hist::{Histogram, HistogramEntry};
5957
pub use image::Image;
6058
#[doc(hidden)]
6159
pub use pal::Palette;
@@ -88,8 +86,7 @@ fn copy_img() {
8886
fn takes_rgba() {
8987
let liq = Attributes::new();
9088

91-
let img = vec![RGBA {r:0, g:0, b:0, a:0}; 8];
92-
89+
let img = vec![RGBA { r: 0, g: 0, b: 0, a: 0 }; 8];
9390

9491
liq.new_image_borrowed(&img, 1, 1, 0.0).unwrap();
9592
liq.new_image_borrowed(&img, 4, 2, 0.0).unwrap();
@@ -103,11 +100,11 @@ fn histogram() {
103100
let attr = Attributes::new();
104101
let mut hist = Histogram::new(&attr);
105102

106-
let bitmap1 = [RGBA {r:0, g:0, b:0, a:0}; 1];
103+
let bitmap1 = [RGBA { r: 0, g: 0, b: 0, a: 0 }; 1];
107104
let mut image1 = attr.new_image(&bitmap1[..], 1, 1, 0.0).unwrap();
108105
hist.add_image(&attr, &mut image1).unwrap();
109106

110-
let bitmap2 = [RGBA {r:255, g:255, b:255, a:255}; 1];
107+
let bitmap2 = [RGBA { r: 255, g: 255, b: 255, a: 255 }; 1];
111108
let mut image2 = attr.new_image(&bitmap2[..], 1, 1, 0.0).unwrap();
112109
hist.add_image(&attr, &mut image2).unwrap();
113110

src/mediancut.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::hist::{HistItem, HistogramInternal};
2-
use crate::pal::{f_pixel, PalF, PalPop};
3-
use crate::pal::{PalLen, ARGBF};
2+
use crate::pal::{f_pixel, PalF, PalLen, PalPop, ARGBF};
43
use crate::quant::quality_to_mse;
54
use crate::PushInCapacity;
65
use crate::{Error, OrdFloat};

src/nearest.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use crate::pal::PalIndex;
2-
use crate::pal::MAX_COLORS;
3-
use crate::pal::{f_pixel, PalF};
1+
use crate::pal::{f_pixel, PalF, PalIndex, MAX_COLORS};
42
use crate::{Error, OrdFloat};
53

64
impl<'pal> Nearest<'pal> {

src/pal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl f_pixel {
7878
vst1q_f32(max_gb.as_mut_ptr(), vpaddq_f32(max, max));
7979

8080
// add rgb, not a
81-
81+
8282
max_r[1] + max_gb[1]
8383
}
8484
}

0 commit comments

Comments
 (0)