diff --git a/examples/compare.rs b/examples/compare.rs
index d8391d2fbf828244895a370aa93bc34a195f6800..b1fafe3d5ba692e4172a67358da8a100dcf7e235 100644
--- a/examples/compare.rs
+++ b/examples/compare.rs
@@ -20,8 +20,8 @@ fn main() {
     for r in (0..256).into_iter().step_by(3) {
         for g in (0..256).into_iter().step_by(4) {
             for b in (0..256).into_iter().step_by(5) {
-                let input = [(r as u8,g as u8,b as u8)];
-                let mut out = [(0,0,0)];
+                let input = [(r as u8, g as u8, b as u8)];
+                let mut out = [(0, 0, 0)];
                 t.transform_pixels(&input, &mut out);
 
                 n += 1;
diff --git a/examples/gamma.rs b/examples/gamma.rs
index 17d4b0826260ffca306b96755a1e0adfe15706f4..8a9eff4fe4a8ff61eaf2a0132f76d07cd98e6955 100644
--- a/examples/gamma.rs
+++ b/examples/gamma.rs
@@ -3,7 +3,7 @@ use lcms2::*;
 
 #[repr(C)]
 #[derive(Copy, Clone, Debug)]
-struct RGB(u8,u8,u8);
+struct RGB(u8, u8, u8);
 
 #[repr(C)]
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
diff --git a/examples/tags.rs b/examples/tags.rs
index cc20dfe3b2b02ee4db3dbc025bed8c2a3021e182..cf9d9f9681524c3cef0af93c964770ffed1ff2c5 100644
--- a/examples/tags.rs
+++ b/examples/tags.rs
@@ -24,8 +24,8 @@ fn main() {
                 for stage in pipeline.stages() {
                     println!(" └─ {:?}", stage);
                 }
-            }
-            _ => {}
+            },
+            _ => {},
         }
     }
 }
diff --git a/src/ciecam.rs b/src/ciecam.rs
index 8e848c0f0aa48ae834119a0c1173c8234adaaa47..3aef833e83459447bbcd63ab01def3eb6e2f889c 100644
--- a/src/ciecam.rs
+++ b/src/ciecam.rs
@@ -17,11 +17,9 @@ impl CIECAM02 {
     ///  Viewing conditions.
     /// Please note those are CAM model viewing conditions, and not the ICC tag viewing conditions, which I'm naming cmsICCViewingConditions to make differences evident. Unfortunately, the tag cannot deal with surround La, Yb and D value so is basically useless to store CAM02 viewing conditions.
     pub fn new(conditions: ViewingConditions) -> LCMSResult<Self> {
-        let handle = unsafe {
-            ffi::cmsCIECAM02Init(ptr::null_mut(), &conditions)
-        };
+        let handle = unsafe { ffi::cmsCIECAM02Init(ptr::null_mut(), &conditions) };
         if !handle.is_null() {
-            Ok(Self {handle})
+            Ok(Self { handle })
         } else {
             Err(Error::ObjectCreationError)
         }
diff --git a/src/context.rs b/src/context.rs
index 07870d63d660f4e92b9e33a9de412b73f4f6fe7f..1bf00447224a8bab8e00a3f556d451456c971228 100644
--- a/src/context.rs
+++ b/src/context.rs
@@ -11,7 +11,7 @@ use std::collections::HashMap;
 /// This context is used by default and you don't need to create it manually.
 #[doc(hidden)]
 pub struct GlobalContext {
-    _not_thread_safe: UnsafeCell<()>
+    _not_thread_safe: UnsafeCell<()>,
 }
 
 #[doc(hidden)]
@@ -90,7 +90,7 @@ impl ThreadContext {
 
     unsafe fn new_handle(handle: ffi::Context) -> Self {
         assert!(!handle.is_null());
-        Self {handle}
+        Self { handle }
     }
 
     pub fn user_data(&self) -> *mut c_void {
@@ -124,9 +124,7 @@ impl ThreadContext {
 
     /// Adaptation state for absolute colorimetric intent, on all but cmsCreateExtendedTransform.
     pub fn adaptation_state(&self) -> f64 {
-        unsafe {
-            ffi::cmsSetAdaptationStateTHR(self.handle, -1.)
-        }
+        unsafe { ffi::cmsSetAdaptationStateTHR(self.handle, -1.) }
     }
 
     /// Sets adaptation state for absolute colorimetric intent in the given context.  Adaptation state applies on all but cmsCreateExtendedTransformTHR().
@@ -143,9 +141,7 @@ impl ThreadContext {
     ///
     /// AlarmCodes: Array [16] of codes. ALL 16 VALUES MUST BE SPECIFIED, set to zero unused channels.
     pub fn set_alarm_codes(&mut self, codes: [u16; ffi::MAXCHANNELS]) {
-        unsafe {
-            ffi::cmsSetAlarmCodesTHR(self.handle, codes.as_ptr())
-        }
+        unsafe { ffi::cmsSetAlarmCodesTHR(self.handle, codes.as_ptr()) }
     }
 
     /// Gets the current codes used to mark out-out-gamut on Proofing transforms for the given context. Values are meant to be encoded in 16 bits.
@@ -160,17 +156,13 @@ impl ThreadContext {
 
 impl Clone for ThreadContext {
     fn clone(&self) -> Self {
-        unsafe {
-            Self::new_handle(ffi::cmsDupContext(self.handle, ptr::null_mut()))
-        }
+        unsafe { Self::new_handle(ffi::cmsDupContext(self.handle, ptr::null_mut())) }
     }
 }
 
 impl Drop for ThreadContext {
     fn drop(&mut self) {
-        unsafe {
-            ffi::cmsDeleteContext(self.handle)
-        }
+        unsafe { ffi::cmsDeleteContext(self.handle) }
     }
 }
 
diff --git a/src/ext.rs b/src/ext.rs
index db2ddd4daab2e311f20601c8f5fea7db36746bc9..77f22c357f9b01c844a7ffa83ba11a5e1ad47cbc 100644
--- a/src/ext.rs
+++ b/src/ext.rs
@@ -12,15 +12,11 @@ pub trait ColorSpaceSignatureExt: Sized + Copy {
 
 impl ColorSpaceSignatureExt for ColorSpaceSignature {
     fn channels(self) -> u32 {
-        unsafe {
-            ffi::cmsChannelsOf(self)
-        }
+        unsafe { ffi::cmsChannelsOf(self) }
     }
 
     fn pixel_format(self) -> PixelFormat {
-        unsafe {
-            mem::transmute(ffi::_cmsLCMScolorSpace(self) as u32)
-        }
+        unsafe { mem::transmute(ffi::_cmsLCMScolorSpace(self) as u32) }
     }
 }
 
@@ -52,9 +48,7 @@ impl CIEXYZExt for CIEXYZ {
 
     fn to_lab(&self, white_point: &CIEXYZ) -> CIELab {
         let mut out = CIELab::default();
-        unsafe {
-            ffi::cmsXYZ2Lab(white_point, &mut out, self)
-        }
+        unsafe { ffi::cmsXYZ2Lab(white_point, &mut out, self) }
         out
     }
 
@@ -76,7 +70,7 @@ pub trait CIExzYExt: Sized {
 impl CIExzYExt for CIExyY {
     fn temp(&self) -> Option<f64> {
         let mut out = 0.;
-        if 0 != unsafe {ffi::cmsTempFromWhitePoint(&mut out, self)} {
+        if 0 != unsafe { ffi::cmsTempFromWhitePoint(&mut out, self) } {
             Some(out)
         } else {
             None
@@ -144,54 +138,38 @@ pub trait CIELabExt: Sized {
 
 impl CIELabExt for CIELab {
     fn cie2000_delta_e(&self, other: &CIELab, kl: f64, kc: f64, kh: f64) -> f64 {
-        unsafe {
-            ffi::cmsCIE2000DeltaE(self, other, kl, kc, kh)
-        }
+        unsafe { ffi::cmsCIE2000DeltaE(self, other, kl, kc, kh) }
     }
 
     fn cie94_delta_e(&self, other: &CIELab) -> f64 {
-        unsafe {
-            ffi::cmsCIE94DeltaE(self, other)
-        }
+        unsafe { ffi::cmsCIE94DeltaE(self, other) }
     }
 
     fn bfd_delta_e(&self, other: &CIELab) -> f64 {
-        unsafe {
-            ffi::cmsBFDdeltaE(self, other)
-        }
+        unsafe { ffi::cmsBFDdeltaE(self, other) }
     }
 
     fn delta_e(&self, other: &CIELab) -> f64 {
-        unsafe {
-            ffi::cmsDeltaE(self, other)
-        }
+        unsafe { ffi::cmsDeltaE(self, other) }
     }
 
     fn cmc_delta_e(&self, other: &CIELab, k: f64, c: f64) -> f64 {
-        unsafe {
-            ffi::cmsCMCdeltaE(self, other, k, c)
-        }
+        unsafe { ffi::cmsCMCdeltaE(self, other, k, c) }
     }
 
     fn desaturate(&mut self, amin: f64, amax: f64, bmin: f64, bmax: f64) -> bool {
-        unsafe {
-            0 != ffi::cmsDesaturateLab(self, amax, amin, bmax, bmin)
-        }
+        unsafe { 0 != ffi::cmsDesaturateLab(self, amax, amin, bmax, bmin) }
     }
 
     fn encoded(&self) -> [u16; 3] {
         let mut out = [0u16; 3];
-        unsafe {
-            ffi::cmsFloat2LabEncoded(out.as_mut_ptr(), self)
-        }
+        unsafe { ffi::cmsFloat2LabEncoded(out.as_mut_ptr(), self) }
         out
     }
 
     fn encoded_v2(&self) -> [u16; 3] {
         let mut out = [0u16; 3];
-        unsafe {
-            ffi::cmsFloat2LabEncodedV2(out.as_mut_ptr(), self)
-        }
+        unsafe { ffi::cmsFloat2LabEncodedV2(out.as_mut_ptr(), self) }
         out
     }
 
@@ -213,9 +191,7 @@ impl CIELabExt for CIELab {
 
     fn to_xyz(&self, white_point: &CIEXYZ) -> CIEXYZ {
         let mut out = CIEXYZ::default();
-        unsafe {
-            ffi::cmsLab2XYZ(white_point, &mut out, self)
-        }
+        unsafe { ffi::cmsLab2XYZ(white_point, &mut out, self) }
         out
     }
 }
diff --git a/src/lib.rs b/src/lib.rs
index 9f0f201c1ac3e3870dcef1ac23be0f79bceb97c6..6ce1db08e96fff90f543d0b78f31a0c933bcbd1e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -95,9 +95,5 @@ pub fn white_point_from_temp(temp: f64) -> Option<CIExyY> {
     let ok = unsafe {
         ffi::cmsWhitePointFromTemp(&mut res, temp) != 0
     };
-    if ok {
-        Some(res)
-    } else {
-        None
-    }
+    if ok { Some(res) } else { None }
 }
diff --git a/src/locale.rs b/src/locale.rs
index 3c91444767513c3aad4c6338cf823222b359923e..9ffc35970497c36ee17218e56fe16e1adfd6112a 100644
--- a/src/locale.rs
+++ b/src/locale.rs
@@ -18,10 +18,10 @@ impl Locale {
             language: [0; 3],
             country: [0; 3],
         };
-        for (c,s) in locale.language.iter_mut().zip(language_str.bytes().take(2)) {
+        for (c, s) in locale.language.iter_mut().zip(language_str.bytes().take(2)) {
             *c = s as i8;
         }
-        for (c,s) in locale.country.iter_mut().zip(country_str.bytes().take(2)) {
+        for (c, s) in locale.country.iter_mut().zip(country_str.bytes().take(2)) {
             *c = s as i8;
         }
         locale
@@ -86,24 +86,24 @@ impl fmt::Display for Locale {
 #[test]
 fn locale() {
     let l = Locale::new("");
-    assert_eq!([0i8;3], l.language);
-    assert_eq!([0i8;3], l.country);
+    assert_eq!([0i8; 3], l.language);
+    assert_eq!([0i8; 3], l.country);
 
     let l = Locale::none();
-    assert_eq!([0i8;3], l.language);
-    assert_eq!([0i8;3], l.country);
+    assert_eq!([0i8; 3], l.language);
+    assert_eq!([0i8; 3], l.country);
 
     let l = Locale::new("Ab");
-    assert_eq!(['A' as i8,'b' as i8,0], l.language);
-    assert_eq!([0i8;3], l.country);
+    assert_eq!(['A' as i8, 'b' as i8, 0], l.language);
+    assert_eq!([0i8; 3], l.country);
 
     let l = Locale::new("Ab-X");
-    assert_eq!(['A' as i8,'b' as i8,0], l.language);
-    assert_eq!(['X' as i8,0,0], l.country);
+    assert_eq!(['A' as i8, 'b' as i8, 0], l.language);
+    assert_eq!(['X' as i8, 0, 0], l.country);
 
     let l = Locale::new("overlong");
-    assert_eq!(['o' as i8,'v' as i8,0], l.language);
-    assert_eq!(['r' as i8,'l' as i8,0], l.country);
+    assert_eq!(['o' as i8, 'v' as i8, 0], l.language);
+    assert_eq!(['r' as i8, 'l' as i8, 0], l.country);
     unsafe {
         assert_eq!('o' as i8, *l.language_ptr());
     }
diff --git a/src/mlu.rs b/src/mlu.rs
index e56e8cf19704ea733292014329cbd43978fbbecc..b8634d26e1f5c8efb669b1e9d0cab3bce361dd4c 100644
--- a/src/mlu.rs
+++ b/src/mlu.rs
@@ -42,7 +42,10 @@ impl MLURef {
 
     /// Fills a UNICODE wide char (16 bit) entry for the given Language and country.
     pub fn set_text(&mut self, text: &str, locale: Locale) -> bool {
-        let chars: Vec<_> = text.chars().map(|c| c as wchar_t).chain(repeat(0 as wchar_t).take(1)).collect();
+        let chars: Vec<_> = text.chars()
+            .map(|c| c as wchar_t)
+            .chain(repeat(0 as wchar_t).take(1))
+            .collect();
 
         unsafe {
             ffi::cmsMLUsetWide(self.as_ptr(),
@@ -145,7 +148,7 @@ impl MLURef {
 impl fmt::Debug for MLURef {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let t = self.text(Locale::none());
-        write!(f, "MLU({:?} {:?})", if let Ok(ref t) = t {&t} else {"None"}, self.tanslations())
+        write!(f, "MLU({:?} {:?})", if let Ok(ref t) = t { &t } else { "None" }, self.tanslations())
     }
 }
 
diff --git a/src/namedcolorlist.rs b/src/namedcolorlist.rs
index dcb6660c0009aab357320029e6c5288b0ebfa4ab..e2ec2d1ce3cab62fbd7b84a0c037c9431239307d 100644
--- a/src/namedcolorlist.rs
+++ b/src/namedcolorlist.rs
@@ -2,7 +2,7 @@ use super::*;
 use std::fmt;
 use std::ptr;
 use foreign_types::ForeignTypeRef;
-use std::ffi::{CStr,CString};
+use std::ffi::{CStr, CString};
 
 #[derive(Clone, Debug, Eq, PartialEq)]
 /// Color in the palette
@@ -40,17 +40,13 @@ impl NamedColorList {
 impl NamedColorListRef {
     /// Number of colors in the palette
     fn len(&self) -> usize {
-        unsafe {
-            ffi::cmsNamedColorCount(self.as_ptr()) as usize
-        }
+        unsafe { ffi::cmsNamedColorCount(self.as_ptr()) as usize }
     }
 
     /// Find color by name
     fn index_of(&self, color_name: &str) -> usize {
         let s = CString::new(color_name).unwrap();
-        unsafe {
-            ffi::cmsNamedColorIndex(self.as_ptr(), s.as_ptr()) as usize
-        }
+        unsafe { ffi::cmsNamedColorIndex(self.as_ptr(), s.as_ptr()) as usize }
     }
 
     /// Get color info
diff --git a/src/pipeline.rs b/src/pipeline.rs
index d003306396a3bfdd6c1c4496219f2cb6998bd3dc..ae2ba3f902bf57222b7967a3c6fef2fcf87d122f 100644
--- a/src/pipeline.rs
+++ b/src/pipeline.rs
@@ -32,15 +32,11 @@ impl PipelineRef {
         if append.input_channels() != self.output_channels() {
             return false;
         }
-        unsafe {
-            ffi::cmsPipelineCat(self.as_ptr(), append.as_ptr()) != 0
-        }
+        unsafe { ffi::cmsPipelineCat(self.as_ptr(), append.as_ptr()) != 0 }
     }
 
     pub fn stage_count(&self) -> usize {
-        unsafe {
-            ffi::cmsPipelineStageCount(self.as_ptr()) as usize
-        }
+        unsafe { ffi::cmsPipelineStageCount(self.as_ptr()) as usize }
     }
 
     pub fn first_stage(&self) -> Option<&StageRef> {
@@ -62,21 +58,15 @@ impl PipelineRef {
     }
 
     pub fn set_8bit(&mut self, on: bool) -> bool {
-        unsafe {
-            ffi::cmsPipelineSetSaveAs8bitsFlag(self.as_ptr(), on as i32) != 0
-        }
+        unsafe { ffi::cmsPipelineSetSaveAs8bitsFlag(self.as_ptr(), on as i32) != 0 }
     }
 
     pub fn input_channels(&self) -> usize {
-        unsafe {
-            ffi::cmsPipelineInputChannels(self.as_ptr()) as usize
-        }
+        unsafe { ffi::cmsPipelineInputChannels(self.as_ptr()) as usize }
     }
 
     pub fn output_channels(&self) -> usize {
-        unsafe {
-            ffi::cmsPipelineOutputChannels(self.as_ptr()) as usize
-        }
+        unsafe { ffi::cmsPipelineOutputChannels(self.as_ptr()) as usize }
     }
 
     // Evaluates a pipeline usin u16 of f32 numbers. With u16 it's optionally using the optimized path.
diff --git a/src/profile.rs b/src/profile.rs
index 03b20e139893a4ec9b54ef01782bf8ccdebeb90b..b08f6f25a56f63930021121670650e3b168ed2fd 100644
--- a/src/profile.rs
+++ b/src/profile.rs
@@ -15,7 +15,7 @@ pub struct Profile<Context = GlobalContext> {
     _context_ref: PhantomData<Context>,
 }
 
-unsafe impl<'a, C:Send> Send for Profile<C> {}
+unsafe impl<'a, C: Send> Send for Profile<C> {}
 
 /// These are the basic functions on opening profiles.
 /// For simpler operation, you must open two profiles using `new_file`, and then create a transform with these open profiles with `Transform`.
@@ -84,7 +84,7 @@ impl Profile<GlobalContext> {
     /// This is a devicelink operating in CMYK for ink-limiting. Currently only cmsSigCmykData is supported.
     /// Limit: Amount of ink limiting in % (0..400%)
     pub fn ink_limiting(color_space: ColorSpaceSignature, limit: f64) -> LCMSResult<Self> {
-        Self::new_handle(unsafe {ffi::cmsCreateInkLimitingDeviceLink(color_space, limit)})
+        Self::new_handle(unsafe { ffi::cmsCreateInkLimitingDeviceLink(color_space, limit) })
     }
 
     /// Generates a device-link profile from a given color transform. This profile can then be used by any other function accepting profile handle.
@@ -178,7 +178,7 @@ impl<Ctx: Context> Profile<Ctx> {
     /// Sets the manufacturer signature in the header.
     ///
     /// This funcionality is widely superseded by the manufaturer tag. Of use only in elder profiles.
-    #[deprecated(note="This funcionality is widely superseded by the manufaturer tag")]
+    #[deprecated(note = "This funcionality is widely superseded by the manufaturer tag")]
     pub fn set_header_manufacturer(&mut self, m: u32) {
         unsafe { ffi::cmsSetHeaderManufacturer(self.handle, m) }
     }
@@ -193,7 +193,7 @@ impl<Ctx: Context> Profile<Ctx> {
     /// Sets the model signature in the profile header.
     ///
     /// This funcionality is widely superseded by the model tag. Of use only in elder profiles.
-    #[deprecated(note="This funcionality is widely superseded by the model tag")]
+    #[deprecated(note = "This funcionality is widely superseded by the model tag")]
     pub fn set_header_model(&mut self, model: u32) {
         unsafe {
             ffi::cmsSetHeaderModel(self.handle, model);
@@ -208,15 +208,11 @@ impl<Ctx: Context> Profile<Ctx> {
     /// Typically, the user or application will set the rendering intent dynamically at runtime or embedding time.
     /// Therefore, this flag may not have any meaning until the profile is used in some context, e.g. in a Devicelink or an embedded source profile.”
     pub fn header_rendering_intent(&self) -> Intent {
-        unsafe {
-            ffi::cmsGetHeaderRenderingIntent(self.handle)
-        }
+        unsafe { ffi::cmsGetHeaderRenderingIntent(self.handle) }
     }
 
     pub fn set_header_rendering_intent(&mut self, intent: Intent) {
-        unsafe {
-            ffi::cmsSetHeaderRenderingIntent(self.handle, intent)
-        }
+        unsafe { ffi::cmsSetHeaderRenderingIntent(self.handle, intent) }
     }
 
     /// Gets the profile connection space used by the given profile, using the ICC convention.
@@ -445,7 +441,7 @@ impl<Ctx: Context> Profile<Ctx> {
     /// This is a devicelink operating in CMYK for ink-limiting. Currently only cmsSigCmykData is supported.
     /// Limit: Amount of ink limiting in % (0..400%)
     pub fn ink_limiting_context(context: Ctx, color_space: ColorSpaceSignature, limit: f64) -> LCMSResult<Self> {
-        Self::new_handle(unsafe {ffi::cmsCreateInkLimitingDeviceLinkTHR(context.as_ptr(), color_space, limit)})
+        Self::new_handle(unsafe { ffi::cmsCreateInkLimitingDeviceLinkTHR(context.as_ptr(), color_space, limit) })
     }
 
     /// Creates a XYZ  XYZ identity, marking it as v4 ICC profile.  WhitePoint used in Absolute colorimetric intent  is D50.
@@ -531,6 +527,6 @@ fn icc() {
 
 #[test]
 fn bad_icc() {
-    let err = Profile::new_icc(&[1,2,3]);
+    let err = Profile::new_icc(&[1, 2, 3]);
     assert!(err.is_err());
 }
diff --git a/src/stage.rs b/src/stage.rs
index 87a530eb8553a070ebadeb00baf6bc6aad498baa..4bdc9b1396e5aad3195463f91e0a6591d9277fd9 100644
--- a/src/stage.rs
+++ b/src/stage.rs
@@ -42,7 +42,7 @@ impl Stage {
     /// Note that Matrix is specified in double precision, whilst CLUT has only float precision.
     /// That is because an ICC profile can encode matrices with far more precision that CLUTS.
     pub fn new_matrix(matrix2d: &[f64], rows: usize, cols: usize, offsets: Option<&[f64]>) -> LCMSResult<Self> {
-        if matrix2d.len() < rows*cols {
+        if matrix2d.len() < rows * cols {
             return Err(Error::MissingData);
         }
         if let Some(offsets) = offsets {
@@ -75,21 +75,15 @@ impl Stage {
 
 impl StageRef {
     pub fn input_channels(&self) -> usize {
-        unsafe {
-            ffi::cmsStageInputChannels(self.as_ptr()) as usize
-        }
+        unsafe { ffi::cmsStageInputChannels(self.as_ptr()) as usize }
     }
 
     pub fn output_channels(&self) -> usize {
-        unsafe {
-            ffi::cmsStageOutputChannels(self.as_ptr()) as usize
-        }
+        unsafe { ffi::cmsStageOutputChannels(self.as_ptr()) as usize }
     }
 
     pub fn stage_type(&self) -> ffi::StageSignature {
-        unsafe {
-            ffi::cmsStageType(self.as_ptr())
-        }
+        unsafe { ffi::cmsStageType(self.as_ptr()) }
     }
 }
 
diff --git a/src/tonecurve.rs b/src/tonecurve.rs
index 3d9c5c873efc67f05f0fdc0f4452fb3651d06f0a..b8ab1aae44ee3fcb77ebfdc66bd12d1380e41c40 100644
--- a/src/tonecurve.rs
+++ b/src/tonecurve.rs
@@ -18,17 +18,13 @@ foreign_type! {
 impl ToneCurve {
     /// Simplified wrapper to `new_parametric`. Builds a parametric curve of type 1.
     pub fn new(gamma: f64) -> Self {
-        unsafe {
-            Self::from_ptr(ffi::cmsBuildGamma(ptr::null_mut(), gamma))
-        }
+        unsafe { Self::from_ptr(ffi::cmsBuildGamma(ptr::null_mut(), gamma)) }
     }
 
     /// Builds a tone curve based on a table of 16-bit values. Tone curves built with this function are restricted to 0…1.0 domain.
     pub fn new_tabulated(values: &[u16]) -> Self {
         assert!(values.len() < std::i32::MAX as usize);
-        unsafe { Self::new_handle(
-            ffi::cmsBuildTabulatedToneCurve16(ptr::null_mut(), values.len() as i32, values.as_ptr())
-        )}
+        unsafe { Self::new_handle(ffi::cmsBuildTabulatedToneCurve16(ptr::null_mut(), values.len() as i32, values.as_ptr())) }
     }
 
     /// Builds a tone curve based on a table of floating point  values. Tone curves built with this function are **not** restricted to 0…1.0 domain.
@@ -83,16 +79,12 @@ impl ToneCurve {
 impl ToneCurveRef {
     /// Creates a tone curve that is the inverse  of given tone curve.
     pub fn reversed(&self) -> ToneCurve {
-        unsafe {
-            ToneCurve::from_ptr(ffi::cmsReverseToneCurve(self.as_ptr()))
-        }
+        unsafe { ToneCurve::from_ptr(ffi::cmsReverseToneCurve(self.as_ptr())) }
     }
 
     /// Creates a tone curve that is the inverse  of given tone curve. In the case it couldn’t be analytically reversed, a tablulated curve of nResultSamples is created.
     pub fn reversed_samples(&self, samples: usize) -> ToneCurve {
-        unsafe {
-            ToneCurve::from_ptr(ffi::cmsReverseToneCurveEx(samples as i32, self.as_ptr()))
-        }
+        unsafe { ToneCurve::from_ptr(ffi::cmsReverseToneCurveEx(samples as i32, self.as_ptr())) }
     }
 
     /// Composites two tone curves in the form Y^-1(X(t))
@@ -131,7 +123,7 @@ impl ToneCurveRef {
     /// Precision: The maximum standard deviation allowed on the residuals, 0.01 is a fair value, set it to a big number to fit any curve, mo matter how good is the fit.
     pub fn estimated_gamma(&self, precision: f64) -> Option<f64> {
         let g = unsafe { ffi::cmsEstimateGamma(self.as_ptr(), precision) };
-        if g <= -1.0 {None} else {Some(g)}
+        if g <= -1.0 { None } else { Some(g) }
     }
 
     /// Smoothes tone curve according to the lambda parameter. From: Eilers, P.H.C. (1994) Smoothing and interpolation with finite differences. in: Graphic Gems IV, Heckbert, P.S. (ed.), Academic press.
@@ -152,17 +144,13 @@ impl ToneCurveRef {
     ///
     /// This function is significantly faster for u16, since it uses a pre-computed 16-bit lookup table.
     pub fn eval<ToneCurveValue: FloatOrU16>(&self, v: ToneCurveValue) -> ToneCurveValue {
-        unsafe {
-            v.eval_tone_curve(self.as_ptr())
-        }
+        unsafe { v.eval_tone_curve(self.as_ptr()) }
     }
 }
 
 impl Clone for ToneCurve {
     fn clone(&self) -> ToneCurve {
-        unsafe {
-            ToneCurve::from_ptr( ffi::cmsDupToneCurve(self.as_ptr()))
-        }
+        unsafe { ToneCurve::from_ptr(ffi::cmsDupToneCurve(self.as_ptr())) }
     }
 }
 
diff --git a/src/transform.rs b/src/transform.rs
index 99819b0902bd3b6d8fec404d58089bc85e0ba39b..ac953d0df2a7767c98567e372f1eb31e62cce012 100644
--- a/src/transform.rs
+++ b/src/transform.rs
@@ -15,7 +15,7 @@ pub struct Transform<InputPixelFormat, OutputPixelFormat, Context = GlobalContex
     _context_ref: PhantomData<Context>,
 }
 
-unsafe impl<'a,F,T,C: Send> Send for Transform<F,T,C> {}
+unsafe impl<'a, F, T, C: Send> Send for Transform<F, T, C> {}
 
 impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone> Transform<InputPixelFormat, OutputPixelFormat, GlobalContext> {
     /// Creates a color transform for translating bitmaps.
@@ -164,22 +164,21 @@ impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone, Ctx: Conte
                                 in_format: PixelFormat, out_format: PixelFormat, intent: Intent, flags: u32) -> LCMSResult<Self> {
         let mut handles: Vec<_> = profiles.iter().map(|p| p.handle).collect();
         unsafe {
-            Self::new_handle(ffi::cmsCreateMultiprofileTransformTHR(context.as_ptr(), handles.as_mut_ptr(), handles.len() as u32,
-                             in_format, out_format, intent, flags),
-                in_format, out_format)
+            Self::new_handle(
+                ffi::cmsCreateMultiprofileTransformTHR(context.as_ptr(), handles.as_mut_ptr(), handles.len() as u32, in_format, out_format, intent, flags),
+                in_format,
+                out_format,
+            )
         }
     }
 }
 
 impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone> Transform<InputPixelFormat, OutputPixelFormat, GlobalContext> {
-
     /// Adaptation state for absolute colorimetric intent, on all but cmsCreateExtendedTransform.
     ///
     /// See `ThreadContext::adaptation_state()`
     pub fn global_adaptation_state() -> f64 {
-        unsafe {
-            ffi::cmsSetAdaptationState(-1.)
-        }
+        unsafe { ffi::cmsSetAdaptationState(-1.) }
     }
 
     /// Sets adaptation state for absolute colorimetric intent, on all but cmsCreateExtendedTransform.
@@ -188,7 +187,7 @@ impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone> Transform<
     /// See `ThreadContext::set_adaptation_state()`
     ///
     /// Degree on adaptation 0=Not adapted, 1=Complete adaptation,  in-between=Partial adaptation.
-    #[deprecated(note="Use `ThreadContext::set_adaptation_state()`")]
+    #[deprecated(note = "Use `ThreadContext::set_adaptation_state()`")]
     pub fn set_global_adaptation_state(value: f64) {
         unsafe {
             ffi::cmsSetAdaptationState(value);
@@ -199,11 +198,9 @@ impl<InputPixelFormat: Copy + Clone, OutputPixelFormat: Copy + Clone> Transform<
     /// AlarmCodes: Array [16] of codes. ALL 16 VALUES MUST BE SPECIFIED, set to zero unused channels.
     ///
     /// See `ThreadContext::set_alarm_codes()`
-    #[deprecated(note="Use `ThreadContext::set_alarm_codes()`")]
+    #[deprecated(note = "Use `ThreadContext::set_alarm_codes()`")]
     pub fn set_global_alarm_codes(codes: [u16; ffi::MAXCHANNELS]) {
-        unsafe {
-            ffi::cmsSetAlarmCodes(codes.as_ptr())
-        }
+        unsafe { ffi::cmsSetAlarmCodes(codes.as_ptr()) }
     }
 
     /// Gets the current global codes used to mark out-out-gamut on Proofing transforms. Values are meant to be encoded in 16 bits.
diff --git a/tests/transform.rs b/tests/transform.rs
index 4d86e7c00d0bfce3915d0bc18bfe92bc1dfbcae1..4b51046ccfed4465e0bd499290a0d649b404ecec 100644
--- a/tests/transform.rs
+++ b/tests/transform.rs
@@ -65,12 +65,8 @@ fn transform_gray_to_gray() {
 
     let tr = Transform::new(&gray, PixelFormat::GRAY_8, &sg, PixelFormat::GRAY_8, Intent::Perceptual).unwrap();
     let mut dest = vec![0u8; 3];
-    tr.transform_pixels(&[0u8,100u8,255u8], &mut dest);
-    assert_eq!(&dest, &[
-        0,
-        119,
-        255,
-    ]);
+    tr.transform_pixels(&[0u8, 100u8, 255u8], &mut dest);
+    assert_eq!(&dest, &[0, 119, 255]);
 }
 
 #[test]