Bug 1684486 - Run cargo clippy on qcms. r=aosmond
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Tue, 29 Dec 2020 23:27:47 +0000
changeset 561794 068e04020830af71ccdbd364302ac44787536cf8
parent 561793 0c1bddfaceddf99e5bfacf89d8c08c2aa9ec85db
child 561795 345d6be71db15bda1400aa8cc2978e99948f6135
push id38067
push userabutkovits@mozilla.com
push dateWed, 30 Dec 2020 21:47:43 +0000
treeherdermozilla-central@f38b3c4372aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaosmond
bugs1684486
milestone86.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1684486 - Run cargo clippy on qcms. r=aosmond Differential Revision: https://phabricator.services.mozilla.com/D100539
gfx/qcms/src/c_bindings.rs
gfx/qcms/src/chain.rs
gfx/qcms/src/gtest.rs
gfx/qcms/src/iccread.rs
gfx/qcms/src/lib.rs
gfx/qcms/src/matrix.rs
gfx/qcms/src/transform.rs
gfx/qcms/src/transform_avx.rs
gfx/qcms/src/transform_sse2.rs
gfx/qcms/src/transform_util.rs
--- a/gfx/qcms/src/c_bindings.rs
+++ b/gfx/qcms/src/c_bindings.rs
@@ -47,17 +47,17 @@ pub unsafe extern "C" fn qcms_profile_cr
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn qcms_profile_create_rgb_with_gamma(
     mut white_point: qcms_CIE_xyY,
     mut primaries: qcms_CIE_xyYTRIPLE,
     mut gamma: f32,
 ) -> *mut qcms_profile {
-    return qcms_profile_create_rgb_with_gamma_set(white_point, primaries, gamma, gamma, gamma);
+    qcms_profile_create_rgb_with_gamma_set(white_point, primaries, gamma, gamma, gamma)
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn qcms_profile_create_rgb_with_table(
     mut white_point: qcms_CIE_xyY,
     mut primaries: qcms_CIE_xyYTRIPLE,
     mut table: *const u16,
     mut num_entries: i32,
@@ -81,38 +81,38 @@ pub unsafe extern "C" fn qcms_profile_fr
     match profile {
         Some(profile) => Box::into_raw(profile),
         None => null_mut(),
     }
 }
 
 #[no_mangle]
 pub extern "C" fn qcms_profile_get_rendering_intent(profile: &qcms_profile) -> Intent {
-    return profile.rendering_intent;
+    profile.rendering_intent
 }
 #[no_mangle]
 pub extern "C" fn qcms_profile_get_color_space(profile: &qcms_profile) -> icColorSpaceSignature {
-    return profile.color_space;
+    profile.color_space
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn qcms_profile_release(mut profile: *mut qcms_profile) {
     drop(Box::from_raw(profile));
 }
 unsafe extern "C" fn qcms_data_from_file(
     mut file: *mut FILE,
     mut mem: *mut *mut libc::c_void,
     mut size: *mut usize,
 ) {
     let mut length: u32;
     let mut remaining_length: u32;
     let mut read_length: usize;
     let mut length_be: be32 = 0;
     let mut data: *mut libc::c_void;
-    *mem = 0 as *mut libc::c_void;
+    *mem = std::ptr::null_mut::<libc::c_void>();
     *size = 0;
     if fread(
         &mut length_be as *mut be32 as *mut libc::c_void,
         1,
         ::std::mem::size_of::<be32>(),
         file,
     ) != ::std::mem::size_of::<be32>()
     {
@@ -130,17 +130,17 @@ unsafe extern "C" fn qcms_data_from_file
         return;
     }
     /* copy in length to the front so that the buffer will contain the entire profile */
     *(data as *mut be32) = length_be;
     remaining_length =
         (length as libc::c_ulong - ::std::mem::size_of::<be32>() as libc::c_ulong) as u32;
     /* read the rest profile */
     read_length = fread(
-        (data as *mut libc::c_uchar).offset(::std::mem::size_of::<be32>() as isize)
+        (data as *mut libc::c_uchar).add(::std::mem::size_of::<be32>())
             as *mut libc::c_void,
         1,
         remaining_length as usize,
         file,
     ) as usize;
     if read_length != remaining_length as usize {
         free(data);
         return;
@@ -149,44 +149,44 @@ unsafe extern "C" fn qcms_data_from_file
     *mem = data;
     *size = length as usize;
 }
 
 #[no_mangle]
 pub unsafe extern "C" fn qcms_profile_from_file(mut file: *mut FILE) -> *mut qcms_profile {
     let mut length: usize = 0;
     let mut profile: *mut qcms_profile;
-    let mut data: *mut libc::c_void = 0 as *mut libc::c_void;
+    let mut data: *mut libc::c_void = std::ptr::null_mut::<libc::c_void>();
     qcms_data_from_file(file, &mut data, &mut length);
     if data.is_null() || length == 0 {
-        return 0 as *mut qcms_profile;
+        return std::ptr::null_mut::<qcms_profile>();
     }
     profile = qcms_profile_from_memory(data, length);
     free(data);
-    return profile;
+    profile
 }
 #[no_mangle]
 pub unsafe extern "C" fn qcms_profile_from_path(
     mut path: *const libc::c_char,
 ) -> *mut qcms_profile {
-    let mut profile: *mut qcms_profile = 0 as *mut qcms_profile;
+    let mut profile: *mut qcms_profile = std::ptr::null_mut::<qcms_profile>();
     let mut file = fopen(path, b"rb\x00" as *const u8 as *const libc::c_char);
     if !file.is_null() {
         profile = qcms_profile_from_file(file);
         fclose(file);
     }
-    return profile;
+    profile
 }
 #[no_mangle]
 pub unsafe extern "C" fn qcms_data_from_path(
     mut path: *const libc::c_char,
     mut mem: *mut *mut libc::c_void,
     mut size: *mut usize,
 ) {
-    *mem = 0 as *mut libc::c_void;
+    *mem = std::ptr::null_mut::<libc::c_void>();
     *size = 0;
     let file = fopen(path, b"rb\x00" as *const u8 as *const libc::c_char);
     if !file.is_null() {
         qcms_data_from_file(file, mem, size);
         fclose(file);
     };
 }
 
--- a/gfx/qcms/src/chain.rs
+++ b/gfx/qcms/src/chain.rs
@@ -59,17 +59,17 @@ pub struct qcms_modular_transform {
     pub transform_module_fn: transform_module_fn_t,
     pub next_transform: Option<Box<qcms_modular_transform>>,
 }
 pub type transform_module_fn_t =
     Option<fn(_: &qcms_modular_transform, _: &[f32], _: &mut [f32]) -> ()>;
 
 #[inline]
 fn lerp(mut a: f32, mut b: f32, mut t: f32) -> f32 {
-    return a * (1.0 - t) + b * t;
+    a * (1.0 - t) + b * t
 }
 
 fn build_lut_matrix(mut lut: Option<&lutType>) -> matrix {
     let mut result: matrix = matrix {
         m: [[0.; 3]; 3],
         invalid: false,
     };
     if let Some(lut) = lut {
@@ -82,17 +82,17 @@ fn build_lut_matrix(mut lut: Option<&lut
         result.m[2][0] = s15Fixed16Number_to_float(lut.e20);
         result.m[2][1] = s15Fixed16Number_to_float(lut.e21);
         result.m[2][2] = s15Fixed16Number_to_float(lut.e22);
         result.invalid = false
     } else {
         result.m = Default::default();
         result.invalid = true
     }
-    return result;
+    result
 }
 fn build_mAB_matrix(lut: &lutmABType) -> matrix {
     let mut result: matrix = matrix {
         m: [[0.; 3]; 3],
         invalid: false,
     };
 
     result.m[0][0] = s15Fixed16Number_to_float(lut.e00);
@@ -101,17 +101,17 @@ fn build_mAB_matrix(lut: &lutmABType) ->
     result.m[1][0] = s15Fixed16Number_to_float(lut.e10);
     result.m[1][1] = s15Fixed16Number_to_float(lut.e11);
     result.m[1][2] = s15Fixed16Number_to_float(lut.e12);
     result.m[2][0] = s15Fixed16Number_to_float(lut.e20);
     result.m[2][1] = s15Fixed16Number_to_float(lut.e21);
     result.m[2][2] = s15Fixed16Number_to_float(lut.e22);
     result.invalid = false;
 
-    return result;
+    result
 }
 //Based on lcms cmsLab2XYZ
 fn f(t: f32) -> f32 {
     if t <= 24. / 116. * (24. / 116.) * (24. / 116.) {
         (841. / 108. * t) + 16. / 116.
     } else {
         t.powf(1. / 3.)
     }
@@ -551,17 +551,17 @@ fn transform_module_matrix(
         let mut out_g: f32 = mat.m[0][1] * in_r + mat.m[1][1] * in_g + mat.m[2][1] * in_b;
         let mut out_b: f32 = mat.m[0][2] * in_r + mat.m[1][2] * in_g + mat.m[2][2] * in_b;
         dest[0] = clamp_float(out_r);
         dest[1] = clamp_float(out_g);
         dest[2] = clamp_float(out_b);
     }
 }
 fn modular_transform_alloc() -> Option<Box<qcms_modular_transform>> {
-    return Some(Box::new(Default::default()));
+    Some(Box::new(Default::default()))
 }
 fn modular_transform_release(mut t: Option<Box<qcms_modular_transform>>) {
     // destroy a list of transforms non-recursively
     let mut next_transform;
     while let Some(mut transform) = t {
         next_transform = std::mem::replace(&mut transform.next_transform, None);
         t = next_transform
     }
@@ -577,43 +577,39 @@ fn append_transform(
     }
     next_transform
 }
 /* reverse the transformation list (used by mBA) */
 fn reverse_transform(
     mut transform: Option<Box<qcms_modular_transform>>,
 ) -> Option<Box<qcms_modular_transform>> {
     let mut prev_transform = None;
-    while !transform.is_none() {
+    while transform.is_some() {
         let mut next_transform = std::mem::replace(
             &mut transform.as_mut().unwrap().next_transform,
             prev_transform,
         );
         prev_transform = transform;
         transform = next_transform
     }
-    return prev_transform;
+    prev_transform
 }
 fn modular_transform_create_mAB(mut lut: &lutmABType) -> Option<Box<qcms_modular_transform>> {
     let mut first_transform = None;
     let mut next_transform = &mut first_transform;
     let mut transform;
-    if !lut.a_curves[0].is_none() {
+    if lut.a_curves[0].is_some() {
         let mut clut_length: usize;
         // If the A curve is present this also implies the
         // presence of a CLUT.
-        if lut.clut_table.is_none() {
-            return None;
-        }
+        lut.clut_table.as_ref()?;
 
         // Prepare A curve.
         transform = modular_transform_alloc();
-        if transform.is_none() {
-            return None;
-        }
+        transform.as_ref()?;
         transform.as_mut().unwrap().input_clut_table_r =
             build_input_gamma_table(lut.a_curves[0].as_deref());
         transform.as_mut().unwrap().input_clut_table_g =
             build_input_gamma_table(lut.a_curves[1].as_deref());
         transform.as_mut().unwrap().input_clut_table_b =
             build_input_gamma_table(lut.a_curves[2].as_deref());
         transform.as_mut().unwrap().transform_module_fn = Some(transform_module_gamma_table);
         next_transform = append_transform(transform, next_transform);
@@ -622,67 +618,59 @@ fn modular_transform_create_mAB(mut lut:
             || lut.num_grid_points[1] as i32 != lut.num_grid_points[2] as i32
         {
             //XXX: We don't currently support clut that are not squared!
             return None;
         }
 
         // Prepare CLUT
         transform = modular_transform_alloc();
-        if transform.is_none() {
-            return None;
-        }
+        transform.as_ref()?;
 
         clut_length = (lut.num_grid_points[0] as usize).pow(3) * 3;
         assert_eq!(clut_length, lut.clut_table.as_ref().unwrap().len());
         transform.as_mut().unwrap().clut = lut.clut_table.clone();
         transform.as_mut().unwrap().grid_size = lut.num_grid_points[0] as u16;
         transform.as_mut().unwrap().transform_module_fn = Some(transform_module_clut_only);
         next_transform = append_transform(transform, next_transform);
     }
 
-    if !lut.m_curves[0].is_none() {
+    if lut.m_curves[0].is_some() {
         // M curve imples the presence of a Matrix
 
         // Prepare M curve
         transform = modular_transform_alloc();
-        if transform.is_none() {
-            return None;
-        }
+        transform.as_ref()?;
         transform.as_mut().unwrap().input_clut_table_r =
             build_input_gamma_table(lut.m_curves[0].as_deref());
         transform.as_mut().unwrap().input_clut_table_g =
             build_input_gamma_table(lut.m_curves[1].as_deref());
         transform.as_mut().unwrap().input_clut_table_b =
             build_input_gamma_table(lut.m_curves[2].as_deref());
         transform.as_mut().unwrap().transform_module_fn = Some(transform_module_gamma_table);
         next_transform = append_transform(transform, next_transform);
 
         // Prepare Matrix
         transform = modular_transform_alloc();
-        if transform.is_none() {
-            return None;
-        }
+        transform.as_ref()?;
         transform.as_mut().unwrap().matrix = build_mAB_matrix(lut);
         if transform.as_mut().unwrap().matrix.invalid {
             return None;
         }
         transform.as_mut().unwrap().tx = s15Fixed16Number_to_float(lut.e03);
         transform.as_mut().unwrap().ty = s15Fixed16Number_to_float(lut.e13);
         transform.as_mut().unwrap().tz = s15Fixed16Number_to_float(lut.e23);
         transform.as_mut().unwrap().transform_module_fn = Some(transform_module_matrix_translate);
         next_transform = append_transform(transform, next_transform);
     }
 
-    if !lut.b_curves[0].is_none() {
+    if lut.b_curves[0].is_some() {
         // Prepare B curve
         transform = modular_transform_alloc();
-        if transform.is_none() {
-            return None;
-        }
+        transform.as_ref()?;
         transform.as_mut().unwrap().input_clut_table_r =
             build_input_gamma_table(lut.b_curves[0].as_deref());
         transform.as_mut().unwrap().input_clut_table_g =
             build_input_gamma_table(lut.b_curves[1].as_deref());
         transform.as_mut().unwrap().input_clut_table_b =
             build_input_gamma_table(lut.b_curves[2].as_deref());
         transform.as_mut().unwrap().transform_module_fn = Some(transform_module_gamma_table);
         append_transform(transform, next_transform);
@@ -691,37 +679,37 @@ fn modular_transform_create_mAB(mut lut:
         return None;
     }
 
     if lut.reversed {
         // mBA are identical to mAB except that the transformation order
         // is reversed
         first_transform = reverse_transform(first_transform)
     }
-    return first_transform;
+    first_transform
 }
 
 fn modular_transform_create_lut(mut lut: &lutType) -> Option<Box<qcms_modular_transform>> {
     let mut first_transform = None;
     let mut next_transform = &mut first_transform;
 
     let mut in_curve_len: usize;
     let mut clut_length: usize;
     let mut out_curve_len: usize;
     let mut in_curves: *mut f32;
     let mut out_curves: *mut f32;
     let mut transform = modular_transform_alloc();
-    if !transform.is_none() {
+    if transform.is_some() {
         transform.as_mut().unwrap().matrix = build_lut_matrix(Some(lut));
         if !transform.as_mut().unwrap().matrix.invalid {
             transform.as_mut().unwrap().transform_module_fn = Some(transform_module_matrix);
             next_transform = append_transform(transform, next_transform);
             // Prepare input curves
             transform = modular_transform_alloc();
-            if !transform.is_none() {
+            if transform.is_some() {
                 transform.as_mut().unwrap().input_clut_table_r =
                     Some(lut.input_table[0..lut.num_input_table_entries as usize].to_vec());
                 transform.as_mut().unwrap().input_clut_table_g = Some(
                     lut.input_table[lut.num_input_table_entries as usize
                         ..lut.num_input_table_entries as usize * 2]
                         .to_vec(),
                 );
                 transform.as_mut().unwrap().input_clut_table_b = Some(
@@ -752,30 +740,30 @@ fn modular_transform_create_lut(mut lut:
                 transform.as_mut().unwrap().output_clut_table_length = lut.num_output_table_entries;
                 transform.as_mut().unwrap().transform_module_fn = Some(transform_module_clut);
                 append_transform(transform, next_transform);
                 return first_transform;
             }
         }
     }
     modular_transform_release(first_transform);
-    return None;
+    None
 }
 
 fn modular_transform_create_input(mut in_0: &qcms_profile) -> Option<Box<qcms_modular_transform>> {
     let mut first_transform = None;
     let mut next_transform = &mut first_transform;
-    if !in_0.A2B0.is_none() {
+    if in_0.A2B0.is_some() {
         let mut lut_transform = modular_transform_create_lut(in_0.A2B0.as_deref().unwrap());
         if lut_transform.is_none() {
             return None;
         } else {
             append_transform(lut_transform, next_transform);
         }
-    } else if !in_0.mAB.is_none()
+    } else if in_0.mAB.is_some()
         && (*in_0.mAB.as_deref().unwrap()).num_in_channels as i32 == 3
         && (*in_0.mAB.as_deref().unwrap()).num_out_channels as i32 == 3
     {
         let mut mAB_transform = modular_transform_create_mAB(in_0.mAB.as_deref().unwrap());
         if mAB_transform.is_none() {
             return None;
         } else {
             append_transform(mAB_transform, next_transform);
@@ -799,25 +787,25 @@ fn modular_transform_create_input(mut in
                 append_transform(transform, next_transform);
                 return None;
             } else {
                 next_transform = append_transform(transform, next_transform);
                 transform = modular_transform_alloc();
                 if transform.is_none() {
                     return None;
                 } else {
-                    transform.as_mut().unwrap().matrix.m[0][0] = 1. / 1.999969482421875;
+                    transform.as_mut().unwrap().matrix.m[0][0] = 1. / 1.999_969_5;
                     transform.as_mut().unwrap().matrix.m[0][1] = 0.0;
                     transform.as_mut().unwrap().matrix.m[0][2] = 0.0;
                     transform.as_mut().unwrap().matrix.m[1][0] = 0.0;
-                    transform.as_mut().unwrap().matrix.m[1][1] = 1. / 1.999969482421875;
+                    transform.as_mut().unwrap().matrix.m[1][1] = 1. / 1.999_969_5;
                     transform.as_mut().unwrap().matrix.m[1][2] = 0.0;
                     transform.as_mut().unwrap().matrix.m[2][0] = 0.0;
                     transform.as_mut().unwrap().matrix.m[2][1] = 0.0;
-                    transform.as_mut().unwrap().matrix.m[2][2] = 1. / 1.999969482421875;
+                    transform.as_mut().unwrap().matrix.m[2][2] = 1. / 1.999_969_5;
                     transform.as_mut().unwrap().matrix.invalid = false;
                     transform.as_mut().unwrap().transform_module_fn = Some(transform_module_matrix);
                     next_transform = append_transform(transform, next_transform);
                     transform = modular_transform_alloc();
                     if transform.is_none() {
                         return None;
                     } else {
                         transform.as_mut().unwrap().matrix = build_colorant_matrix(in_0);
@@ -829,54 +817,54 @@ fn modular_transform_create_input(mut in
             }
         }
     }
     first_transform
 }
 fn modular_transform_create_output(mut out: &qcms_profile) -> Option<Box<qcms_modular_transform>> {
     let mut first_transform = None;
     let mut next_transform = &mut first_transform;
-    if !out.B2A0.is_none() {
+    if out.B2A0.is_some() {
         let mut lut_transform = modular_transform_create_lut(out.B2A0.as_deref().unwrap());
         if lut_transform.is_none() {
             return None;
         } else {
             append_transform(lut_transform, next_transform);
         }
-    } else if !out.mBA.is_none()
+    } else if out.mBA.is_some()
         && (*out.mBA.as_deref().unwrap()).num_in_channels as i32 == 3
         && (*out.mBA.as_deref().unwrap()).num_out_channels as i32 == 3
     {
         let mut lut_transform_0 = modular_transform_create_mAB(out.mBA.as_deref().unwrap());
         if lut_transform_0.is_none() {
             return None;
         } else {
             append_transform(lut_transform_0, next_transform);
         }
-    } else if !out.redTRC.is_none() && !out.greenTRC.is_none() && !out.blueTRC.is_none() {
+    } else if out.redTRC.is_some() && out.greenTRC.is_some() && out.blueTRC.is_some() {
         let mut transform = modular_transform_alloc();
         if transform.is_none() {
             return None;
         } else {
             transform.as_mut().unwrap().matrix = matrix_invert(build_colorant_matrix(out));
             transform.as_mut().unwrap().transform_module_fn = Some(transform_module_matrix);
             next_transform = append_transform(transform, next_transform);
             transform = modular_transform_alloc();
             if transform.is_none() {
                 return None;
             } else {
-                transform.as_mut().unwrap().matrix.m[0][0] = 1.999969482421875;
+                transform.as_mut().unwrap().matrix.m[0][0] = 1.999_969_5;
                 transform.as_mut().unwrap().matrix.m[0][1] = 0.0;
                 transform.as_mut().unwrap().matrix.m[0][2] = 0.0;
                 transform.as_mut().unwrap().matrix.m[1][0] = 0.0;
-                transform.as_mut().unwrap().matrix.m[1][1] = 1.999969482421875;
+                transform.as_mut().unwrap().matrix.m[1][1] = 1.999_969_5;
                 transform.as_mut().unwrap().matrix.m[1][2] = 0.0;
                 transform.as_mut().unwrap().matrix.m[2][0] = 0.0;
                 transform.as_mut().unwrap().matrix.m[2][1] = 0.0;
-                transform.as_mut().unwrap().matrix.m[2][2] = 1.999969482421875;
+                transform.as_mut().unwrap().matrix.m[2][2] = 1.999_969_5;
                 transform.as_mut().unwrap().matrix.invalid = false;
                 transform.as_mut().unwrap().transform_module_fn = Some(transform_module_matrix);
                 next_transform = append_transform(transform, next_transform);
                 transform = modular_transform_alloc();
                 if transform.is_none() {
                     return None;
                 } else {
                     transform.as_mut().unwrap().output_gamma_lut_r =
@@ -958,30 +946,26 @@ remove_next:
 fn modular_transform_create(
     mut in_0: &qcms_profile,
     mut out: &qcms_profile,
 ) -> Option<Box<qcms_modular_transform>> {
     let mut first_transform = None;
     let mut next_transform = &mut first_transform;
     if in_0.color_space == RGB_SIGNATURE {
         let mut rgb_to_pcs = modular_transform_create_input(in_0);
-        if rgb_to_pcs.is_none() {
-            return None;
-        }
+        rgb_to_pcs.as_ref()?;
         next_transform = append_transform(rgb_to_pcs, next_transform);
     } else {
         debug_assert!(false, "input color space not supported");
         return None;
     }
 
     if in_0.pcs == LAB_SIGNATURE && out.pcs == XYZ_SIGNATURE {
         let mut lab_to_pcs = modular_transform_alloc();
-        if lab_to_pcs.is_none() {
-            return None;
-        }
+        lab_to_pcs.as_ref()?;
         lab_to_pcs.as_mut().unwrap().transform_module_fn = Some(transform_module_LAB_to_XYZ);
         next_transform = append_transform(lab_to_pcs, next_transform);
     }
 
     // This does not improve accuracy in practice, something is wrong here.
     //if (in->chromaticAdaption.invalid == false) {
     //	struct qcms_modular_transform* chromaticAdaption;
     //	chromaticAdaption = qcms_modular_transform_alloc();
@@ -989,66 +973,62 @@ fn modular_transform_create(
     //		goto fail;
     //	append_transform(chromaticAdaption, &next_transform);
     //	chromaticAdaption->matrix = matrix_invert(in->chromaticAdaption);
     //	chromaticAdaption->transform_module_fn = qcms_transform_module_matrix;
     //}
 
     if in_0.pcs == XYZ_SIGNATURE && out.pcs == LAB_SIGNATURE {
         let mut pcs_to_lab = modular_transform_alloc();
-        if pcs_to_lab.is_none() {
-            return None;
-        }
+        pcs_to_lab.as_ref()?;
         pcs_to_lab.as_mut().unwrap().transform_module_fn = Some(transform_module_XYZ_to_LAB);
         next_transform = append_transform(pcs_to_lab, next_transform);
     }
 
     if out.color_space == RGB_SIGNATURE {
         let mut pcs_to_rgb = modular_transform_create_output(out);
-        if pcs_to_rgb.is_none() {
-            return None;
-        }
+        pcs_to_rgb.as_ref()?;
         append_transform(pcs_to_rgb, next_transform);
     } else {
         debug_assert!(false, "output color space not supported");
     }
 
     // Not Completed
     //return qcms_modular_transform_reduce(first_transform);
-    return first_transform;
+    first_transform
 }
 fn modular_transform_data(
     mut transform: Option<&qcms_modular_transform>,
     mut src: Vec<f32>,
     mut dest: Vec<f32>,
     mut len: usize,
 ) -> Option<Vec<f32>> {
-    while !transform.is_none() {
+    while transform.is_some() {
         // Keep swaping src/dest when performing a transform to use less memory.
         let transform_fn: transform_module_fn_t = transform.unwrap().transform_module_fn;
         transform
             .unwrap()
             .transform_module_fn
             .expect("non-null function pointer")(
             transform.as_ref().unwrap(), &src, &mut dest
         );
         std::mem::swap(&mut src, &mut dest);
         transform = transform.unwrap().next_transform.as_deref();
     }
     // The results end up in the src buffer because of the switching
-    return Some(src);
+    Some(src)
 }
 
 pub fn chain_transform(
     mut in_0: &qcms_profile,
     mut out: &qcms_profile,
     mut src: Vec<f32>,
     mut dest: Vec<f32>,
     mut lutSize: usize,
 ) -> Option<Vec<f32>> {
     let mut transform_list = modular_transform_create(in_0, out);
-    if !transform_list.is_none() {
+    if transform_list.is_some() {
         let mut lut = modular_transform_data(transform_list.as_deref(), src, dest, lutSize / 3);
         modular_transform_release(transform_list);
         return lut;
     }
-    return None;
+    None
 }
--- a/gfx/qcms/src/gtest.rs
+++ b/gfx/qcms/src/gtest.rs
@@ -544,17 +544,17 @@ mod test {
             }
         }
 
         unsafe fn SetTransform(&mut self, transform: *mut qcms_transform) -> bool {
             if self.transform != null_mut() {
                 qcms_transform_release(self.transform)
             }
             self.transform = transform;
-            !(self.transform == null_mut())
+            self.transform != null_mut()
         }
 
         unsafe fn SetTransformForType(&mut self, ty: qcms_data_type) -> bool {
             self.SetTransform(qcms_transform_create(
                 &*self.in_profile,
                 ty,
                 &*self.out_profile,
                 ty,
@@ -625,26 +625,26 @@ mod test {
                 self.input.as_mut_ptr(),
                 self.output.as_mut_ptr(),
                 self.pixels,
             )
         }
 
         unsafe fn VerifyOutput(&self, buf: &[u8]) -> bool {
             match self.storage_type {
-                DATA_RGB_8 => return CmpRgbBuffer(buf, &self.output, self.pixels),
-                DATA_RGBA_8 => return CmpRgbaBuffer(buf, &self.output, self.pixels),
-                DATA_BGRA_8 => return CmpBgraBuffer(buf, &self.output, self.pixels),
+                DATA_RGB_8 => CmpRgbBuffer(buf, &self.output, self.pixels),
+                DATA_RGBA_8 => CmpRgbaBuffer(buf, &self.output, self.pixels),
+                DATA_BGRA_8 => CmpBgraBuffer(buf, &self.output, self.pixels),
                 _ => unreachable!("Unknown type!"),
             }
         }
 
         unsafe fn ProduceVerifyOutput(&mut self, trans_fn: transform_fn_t) -> bool {
             self.ProduceOutput(trans_fn);
-            return self.VerifyOutput(&self.reference);
+            self.VerifyOutput(&self.reference)
         }
 
         unsafe fn PrecacheOutput(&mut self) {
             qcms_profile_precache_output_transform(&mut *self.out_profile);
             self.precache = true;
         }
         unsafe fn TransformPrecache(&mut self) {
             assert_eq!(self.precache, false);
--- a/gfx/qcms/src/iccread.rs
+++ b/gfx/qcms/src/iccread.rs
@@ -192,22 +192,22 @@ type tag_index = [tag];
 struct mem_source<'a> {
     pub buf: &'a [u8],
     pub valid: bool,
     pub invalid_reason: Option<&'static str>,
 }
 pub type uInt8Number = u8;
 #[inline]
 fn uInt8Number_to_float(mut a: uInt8Number) -> f32 {
-    return a as i32 as f32 / 255.0;
+    a as i32 as f32 / 255.0
 }
 
 #[inline]
 fn uInt16Number_to_float(mut a: uInt16Number) -> f32 {
-    return a as i32 as f32 / 65535.0;
+    a as i32 as f32 / 65535.0
 }
 
 fn cpu_to_be32(mut v: u32) -> be32 {
     v.to_be()
 }
 fn cpu_to_be16(mut v: u16) -> be16 {
     v.to_be()
 }
@@ -222,68 +222,68 @@ fn invalid_source(mut mem: &mut mem_sour
     mem.invalid_reason = Some(reason);
 }
 fn read_u32(mut mem: &mut mem_source, mut offset: usize) -> u32 {
     /* Subtract from mem->size instead of the more intuitive adding to offset.
      * This avoids overflowing offset. The subtraction is safe because
      * mem->size is guaranteed to be > 4 */
     if offset > mem.buf.len() - 4 {
         invalid_source(mem, "Invalid offset");
-        return 0;
+        0
     } else {
         let k = unsafe {
-            std::ptr::read_unaligned(mem.buf.as_ptr().offset(offset as isize) as *const be32)
+            std::ptr::read_unaligned(mem.buf.as_ptr().add(offset) as *const be32)
         };
-        return be32_to_cpu(k);
+        be32_to_cpu(k)
     }
 }
 fn read_u16(mut mem: &mut mem_source, mut offset: usize) -> u16 {
     if offset > mem.buf.len() - 2 {
         invalid_source(mem, "Invalid offset");
-        return 0u16;
+        0u16
     } else {
         let k = unsafe {
-            std::ptr::read_unaligned(mem.buf.as_ptr().offset(offset as isize) as *const be16)
+            std::ptr::read_unaligned(mem.buf.as_ptr().add(offset) as *const be16)
         };
-        return be16_to_cpu(k);
+        be16_to_cpu(k)
     }
 }
 fn read_u8(mut mem: &mut mem_source, mut offset: usize) -> u8 {
     if offset > mem.buf.len() - 1 {
         invalid_source(mem, "Invalid offset");
-        return 0u8;
+        0u8
     } else {
-        return unsafe { *(mem.buf.as_ptr().offset(offset as isize) as *mut u8) };
+        unsafe { *(mem.buf.as_ptr().add(offset) as *mut u8) }
     }
 }
 fn read_s15Fixed16Number(mut mem: &mut mem_source, mut offset: usize) -> s15Fixed16Number {
-    return read_u32(mem, offset) as s15Fixed16Number;
+    read_u32(mem, offset) as s15Fixed16Number
 }
 fn read_uInt8Number(mut mem: &mut mem_source, mut offset: usize) -> uInt8Number {
-    return read_u8(mem, offset);
+    read_u8(mem, offset)
 }
 fn read_uInt16Number(mut mem: &mut mem_source, mut offset: usize) -> uInt16Number {
-    return read_u16(mem, offset);
+    read_u16(mem, offset)
 }
 fn write_u32(mut mem: &mut [u8], mut offset: usize, mut value: u32) {
     if offset <= mem.len() - std::mem::size_of_val(&value) {
         panic!("OOB");
     }
     let mem = mem.as_mut_ptr();
     unsafe {
-        std::ptr::write_unaligned(mem.offset(offset as isize) as *mut u32, cpu_to_be32(value));
+        std::ptr::write_unaligned(mem.add(offset) as *mut u32, cpu_to_be32(value));
     }
 }
 fn write_u16(mut mem: &mut [u8], mut offset: usize, mut value: u16) {
     if offset <= mem.len() - std::mem::size_of_val(&value) {
         panic!("OOB");
     }
     let mem = mem.as_mut_ptr();
     unsafe {
-        std::ptr::write_unaligned(mem.offset(offset as isize) as *mut u16, cpu_to_be16(value));
+        std::ptr::write_unaligned(mem.add(offset) as *mut u16, cpu_to_be16(value));
     }
 }
 
 /* An arbitrary 4MB limit on profile size */
 pub(crate) const MAX_PROFILE_SIZE: usize = 1024 * 1024 * 4;
 const MAX_TAG_COUNT: u32 = 1024;
 
 fn check_CMM_type_signature(mut src: &mut mem_source) {
@@ -456,20 +456,20 @@ pub extern "C" fn qcms_profile_is_bogus(
     let mut bY: f32;
     let mut bZ: f32;
     let mut negative: bool;
     let mut i: libc::c_uint;
     // We currently only check the bogosity of RGB profiles
     if profile.color_space != RGB_SIGNATURE {
         return false;
     }
-    if !profile.A2B0.is_none()
-        || !profile.B2A0.is_none()
-        || !profile.mAB.is_none()
-        || !profile.mBA.is_none()
+    if profile.A2B0.is_some()
+        || profile.B2A0.is_some()
+        || profile.mAB.is_some()
+        || profile.mBA.is_some()
     {
         return false;
     }
     rX = s15Fixed16Number_to_float(profile.redColorant.X);
     rY = s15Fixed16Number_to_float(profile.redColorant.Y);
     rZ = s15Fixed16Number_to_float(profile.redColorant.Z);
     gX = s15Fixed16Number_to_float(profile.greenColorant.X);
     gY = s15Fixed16Number_to_float(profile.greenColorant.Y);
@@ -495,17 +495,17 @@ pub extern "C" fn qcms_profile_is_bogus(
     // Compare with our tolerance
     i = 0;
     while i < 3 {
         if !(sum[i as usize] - tolerance[i as usize] <= target[i as usize]
             && sum[i as usize] + tolerance[i as usize] >= target[i as usize])
         {
             return true;
         }
-        i = i + 1
+        i += 1
     }
     if !cfg!(target_os = "macos") {
         negative = (rX < 0.)
             || (rY < 0.)
             || (rZ < 0.)
             || (gX < 0.)
             || (gY < 0.)
             || (gZ < 0.)
@@ -521,17 +521,17 @@ pub extern "C" fn qcms_profile_is_bogus(
 
         // FIXME: allow this relaxation on all ports?
         negative = false; // bogus
     }
     if negative {
         return true;
     }
     // All Good
-    return false;
+    false
 }
 
 const TAG_bXYZ: u32 = 0x6258595a;
 const TAG_gXYZ: u32 = 0x6758595a;
 const TAG_rXYZ: u32 = 0x7258595a;
 const TAG_rTRC: u32 = 0x72545243;
 const TAG_bTRC: u32 = 0x62545243;
 const TAG_gTRC: u32 = 0x67545243;
@@ -576,24 +576,24 @@ fn read_tag_s15Fixed16ArrayType(
         if type_0 != CHROMATIC_TYPE {
             invalid_source(src, "unexpected type, expected \'sf32\'");
         }
         i = 0u8;
         while (i as i32) < 9 {
             matrix.m[(i as i32 / 3) as usize][(i as i32 % 3) as usize] = s15Fixed16Number_to_float(
                 read_s15Fixed16Number(src, (offset + 8 + (i as i32 * 4) as libc::c_uint) as usize),
             );
-            i = i + 1
+            i += 1
         }
         matrix.invalid = false
     } else {
         matrix.invalid = true;
         invalid_source(src, "missing sf32tag");
     }
-    return matrix;
+    matrix
 }
 fn read_tag_XYZType(mut src: &mut mem_source, mut index: &tag_index, mut tag_id: u32) -> XYZNumber {
     let mut num: XYZNumber = {
         let mut init = XYZNumber { X: 0, Y: 0, Z: 0 };
         init
     };
     let mut tag = find_tag(&index, tag_id);
     if let Some(tag) = tag {
@@ -603,17 +603,17 @@ fn read_tag_XYZType(mut src: &mut mem_so
             invalid_source(src, "unexpected type, expected XYZ");
         }
         num.X = read_s15Fixed16Number(src, (offset + 8) as usize);
         num.Y = read_s15Fixed16Number(src, (offset + 12) as usize);
         num.Z = read_s15Fixed16Number(src, (offset + 16) as usize)
     } else {
         invalid_source(src, "missing xyztag");
     }
-    return num;
+    num
 }
 // Read the tag at a given offset rather then the tag_index.
 // This method is used when reading mAB tags where nested curveType are
 // present that are not part of the tag_index.
 fn read_curveType(
     mut src: &mut mem_source,
     mut offset: u32,
     mut len: &mut u32,
@@ -634,17 +634,17 @@ fn read_curveType(
             invalid_source(src, "curve size too large");
             return None;
         }
         let mut table = Vec::with_capacity(count as usize);
         for i in 0..count {
             table.push(read_u16(src, (offset + 12 + i * 2) as usize));
         }
         *len = 12 + count * 2;
-        return Some(Box::new(curveType::Curve(table)));
+        Some(Box::new(curveType::Curve(table)))
     } else {
         count = read_u16(src, (offset + 8) as usize) as u32;
         if count > 4 {
             invalid_source(src, "parametric function type not supported.");
             return None;
         }
         let mut params = Vec::with_capacity(count as usize);
         for i in 0..COUNT_TO_LENGTH[count as usize] {
@@ -656,32 +656,32 @@ fn read_curveType(
         *len = 12 + COUNT_TO_LENGTH[count as usize] * 4;
         if count == 1 || count == 2 {
             /* we have a type 1 or type 2 function that has a division by 'a' */
             let mut a: f32 = params[1];
             if a == 0.0 {
                 invalid_source(src, "parametricCurve definition causes division by zero");
             }
         }
-        return Some(Box::new(curveType::Parametric(params)));
+        Some(Box::new(curveType::Parametric(params)))
     }
 }
 fn read_tag_curveType(
     mut src: &mut mem_source,
     mut index: &tag_index,
     mut tag_id: u32,
 ) -> Option<Box<curveType>> {
     let mut tag = find_tag(index, tag_id);
     if let Some(tag) = tag {
         let mut len: u32 = 0;
         return read_curveType(src, tag.offset, &mut len);
     } else {
         invalid_source(src, "missing curvetag");
     }
-    return None;
+    None
 }
 // arbitrary
 fn read_nested_curveType(
     mut src: &mut mem_source,
     mut curveArray: &mut [Option<Box<curveType>>; 10],
     mut num_channels: u8,
     mut curve_offset: u32,
 ) {
@@ -690,20 +690,20 @@ fn read_nested_curveType(
     i = 0;
     while i < num_channels as i32 {
         let mut tag_len: u32 = 0;
         curveArray[i as usize] = read_curveType(src, curve_offset + channel_offset, &mut tag_len);
         if curveArray[i as usize].is_none() {
             invalid_source(src, "invalid nested curveType curve");
             break;
         } else {
-            channel_offset = channel_offset + tag_len;
+            channel_offset += tag_len;
             // 4 byte aligned
             if tag_len % 4 != 0 {
-                channel_offset = channel_offset + (4 - tag_len % 4)
+                channel_offset += 4 - tag_len % 4
             }
             i += 1
         }
     }
 }
 
 /* See section 10.10 for specs */
 fn read_tag_lutmABType(mut src: &mut mem_source, mut tag: &tag) -> Option<Box<lutmABType>> {
@@ -740,60 +740,60 @@ fn read_tag_lutmABType(mut src: &mut mem
     a_curve_offset = read_u32(src, (offset + 28) as usize);
     clut_offset = read_u32(src, (offset + 24) as usize);
     m_curve_offset = read_u32(src, (offset + 20) as usize);
     matrix_offset = read_u32(src, (offset + 16) as usize);
     b_curve_offset = read_u32(src, (offset + 12) as usize);
     // Convert offsets relative to the tag to relative to the profile
     // preserve zero for optional fields
     if a_curve_offset != 0 {
-        a_curve_offset = a_curve_offset + offset
+        a_curve_offset += offset
     }
     if clut_offset != 0 {
-        clut_offset = clut_offset + offset
+        clut_offset += offset
     }
     if m_curve_offset != 0 {
-        m_curve_offset = m_curve_offset + offset
+        m_curve_offset += offset
     }
     if matrix_offset != 0 {
-        matrix_offset = matrix_offset + offset
+        matrix_offset += offset
     }
     if b_curve_offset != 0 {
-        b_curve_offset = b_curve_offset + offset
+        b_curve_offset += offset
     }
     if clut_offset != 0 {
         debug_assert!(num_in_channels as i32 == 3);
         // clut_size can not overflow since lg(256^num_in_channels) = 24 bits.
         i = 0;
         while i < num_in_channels as libc::c_uint {
-            clut_size = clut_size * read_u8(src, (clut_offset + i) as usize) as libc::c_uint;
+            clut_size *= read_u8(src, (clut_offset + i) as usize) as libc::c_uint;
             if clut_size == 0 {
                 invalid_source(src, "bad clut_size");
             }
-            i = i + 1
+            i += 1
         }
     } else {
         clut_size = 0
     }
     // 24bits * 3 won't overflow either
-    clut_size = clut_size * num_out_channels as libc::c_uint;
+    clut_size *= num_out_channels as libc::c_uint;
     if clut_size > 500000 {
         return None;
     }
 
     lut = Box::new(lutmABType::default());
 
     if clut_offset != 0 {
         i = 0;
         while i < num_in_channels as libc::c_uint {
             lut.num_grid_points[i as usize] = read_u8(src, (clut_offset + i) as usize);
             if lut.num_grid_points[i as usize] as i32 == 0 {
                 invalid_source(src, "bad grid_points");
             }
-            i = i + 1
+            i += 1
         }
     }
     // Reverse the processing of transformation elements for mBA type.
     lut.reversed = type_0 == LUT_MBA_TYPE;
     lut.num_in_channels = num_in_channels;
     lut.num_out_channels = num_out_channels;
     if matrix_offset != 0 {
         // read the matrix if we have it
@@ -842,17 +842,17 @@ fn read_tag_lutmABType(mut src: &mut mem
             lut.clut_table = Some(clut_table);
         } else {
             invalid_source(src, "Invalid clut precision");
         }
     }
     if !src.valid {
         return None;
     }
-    return Some(lut);
+    Some(lut)
 }
 fn read_tag_lutType(mut src: &mut mem_source, mut tag: &tag) -> Option<Box<lutType>> {
     let mut offset: u32 = tag.offset;
     let mut type_0: u32 = read_u32(src, offset as usize);
     let mut num_input_table_entries: u16;
     let mut num_output_table_entries: u16;
     let mut in_chan: u8;
     let mut grid_points: u8;
@@ -977,18 +977,18 @@ fn read_tag_lutType(mut src: &mut mem_so
         } else {
             output_table.push(uInt16Number_to_float(read_uInt16Number(
                 src,
                 output_offset as usize + i as usize * entry_size,
             )))
         }
     }
     Some(Box::new(lutType {
-        num_input_table_entries: num_input_table_entries,
-        num_output_table_entries: num_output_table_entries,
+        num_input_table_entries,
+        num_output_table_entries,
         num_input_channels: in_chan,
         num_output_channels: out_chan,
         num_clut_grid_points: grid_points,
         e00,
         e01,
         e02,
         e10,
         e11,
@@ -1051,28 +1051,28 @@ fn build_sRGB_gamma_table(mut num_entrie
         if output > 65535.0f64 {
             output = 65535f64
         }
         if output < 0f64 {
             output = 0f64
         }
         table.push(output.floor() as u16);
     }
-    return table;
+    table
 }
 fn curve_from_table(mut table: &[u16]) -> Box<curveType> {
-    return Box::new(curveType::Curve(table.to_vec()));
+    Box::new(curveType::Curve(table.to_vec()))
 }
 fn float_to_u8Fixed8Number(mut a: f32) -> u16 {
     if a > 255.0 + 255.0 / 256f32 {
-        return 0xffffu16;
+        0xffffu16
     } else if a < 0.0 {
-        return 0u16;
+        0u16
     } else {
-        return (a * 256.0 + 0.5).floor() as u16;
+        (a * 256.0 + 0.5).floor() as u16
     }
 }
 
 fn curve_from_gamma(mut gamma: f32) -> Box<curveType> {
     Box::new(curveType::Curve(vec![float_to_u8Fixed8Number(gamma)]))
 }
 
 /* from lcms: cmsWhitePointFromTemp */
@@ -1120,21 +1120,21 @@ fn white_point_from_temp(mut temp_K: i32
     y = -3.000f64 * (x * x) + 2.870f64 * x - 0.275f64;
     // wave factors (not used, but here for futures extensions)
     // M1 = (-1.3515 - 1.7703*x + 5.9114 *y)/(0.0241 + 0.2562*x - 0.7341*y);
     // M2 = (0.0300 - 31.4424*x + 30.0717*y)/(0.0241 + 0.2562*x - 0.7341*y);
     // Fill white_point struct
     white_point.x = x;
     white_point.y = y;
     white_point.Y = 1.0f64;
-    return white_point;
+    white_point
 }
 #[no_mangle]
 pub extern "C" fn qcms_white_point_sRGB() -> qcms_CIE_xyY {
-    return white_point_from_temp(6504);
+    white_point_from_temp(6504)
 }
 
 impl qcms_profile {
     //XXX: it would be nice if we had a way of ensuring
     // everything in a profile was initialized regardless of how it was created
     //XXX: should this also be taking a black_point?
     /* similar to CGColorSpaceCreateCalibratedRGB */
     pub fn new_rgb_with_table(
@@ -1149,17 +1149,17 @@ impl qcms_profile {
         }
         profile.redTRC = Some(curve_from_table(table));
         profile.blueTRC = Some(curve_from_table(table));
         profile.greenTRC = Some(curve_from_table(table));
         profile.class_type = DISPLAY_DEVICE_PROFILE;
         profile.rendering_intent = QCMS_INTENT_PERCEPTUAL;
         profile.color_space = RGB_SIGNATURE;
         profile.pcs = XYZ_TYPE;
-        return Some(profile);
+        Some(profile)
     }
     pub fn new_sRGB() -> Box<qcms_profile> {
         let Rec709Primaries = qcms_CIE_xyYTRIPLE {
             red: {
                 qcms_CIE_xyY {
                     x: 0.6400f64,
                     y: 0.3300f64,
                     Y: 1.0f64,
@@ -1311,19 +1311,17 @@ impl qcms_profile {
                         || profile.blueTRC.is_none()
                         || profile.greenTRC.is_none()
                     {
                         return None;
                     }
                 }
             } else if profile.color_space == GRAY_SIGNATURE {
                 profile.grayTRC = read_tag_curveType(src, &index, TAG_kTRC);
-                if profile.grayTRC.is_none() {
-                    return None;
-                }
+                profile.grayTRC.as_ref()?;
             } else {
                 debug_assert!(false, "read_color_space protects against entering here");
                 return None;
             }
         } else {
             return None;
         }
 
@@ -1358,17 +1356,17 @@ pub unsafe extern "C" fn qcms_data_creat
         m: [[0.; 3]; 3],
         invalid: false,
     };
     let mut TAG_XYZ: [u32; 3] = [TAG_rXYZ, TAG_gXYZ, TAG_bXYZ];
     let mut TAG_TRC: [u32; 3] = [TAG_rTRC, TAG_gTRC, TAG_bTRC];
     if mem.is_null() || size.is_null() {
         return;
     }
-    *mem = 0 as *mut libc::c_void;
+    *mem = std::ptr::null_mut::<libc::c_void>();
     *size = 0;
     /*
     	* total length = icc profile header(128) + tag count(4) +
     	* (tag table item (12) * total tag (6 = 3 rTRC + 3 rXYZ)) + rTRC elements data (3 * 20)
     	* + rXYZ elements data (3*16), and all tag data elements must start at the 4-byte boundary.
     	*/
     xyz_count = 3; // rXYZ, gXYZ, bXYZ
     trc_count = 3; // rTRC, gTRC, bTRC
@@ -1408,35 +1406,35 @@ pub unsafe extern "C" fn qcms_data_creat
             tag_data_offset + 12,
             double_to_s15Fixed16Number(colorants.m[1][index as usize] as f64) as u32,
         );
         write_u32(
             data,
             tag_data_offset + 16,
             double_to_s15Fixed16Number(colorants.m[2][index as usize] as f64) as u32,
         );
-        tag_table_offset = tag_table_offset + 12;
-        tag_data_offset = tag_data_offset + 20;
-        index = index + 1
+        tag_table_offset += 12;
+        tag_data_offset += 20;
+        index += 1
     }
     // Part2 : write rTRC, gTRC and bTRC
     index = 0;
     while index < trc_count {
         // tag table
         write_u32(data, tag_table_offset, TAG_TRC[index as usize]); // 14 bytes per TAG_(r/g/b)TRC element
         write_u32(data, tag_table_offset + 4, tag_data_offset as u32);
         write_u32(data, tag_table_offset + 8, 14);
         // tag data element
         write_u32(data, tag_data_offset, CURVE_TYPE);
         // reserved 4 bytes.
         write_u32(data, tag_data_offset + 8, 1); // count
         write_u16(data, tag_data_offset + 12, float_to_u8Fixed8Number(gamma));
-        tag_table_offset = tag_table_offset + 12;
-        tag_data_offset = tag_data_offset + 16;
-        index = index + 1
+        tag_table_offset += 12;
+        tag_data_offset += 16;
+        index += 1
     }
     /* Part3 : write profile header
      *
      * Important header fields are left empty. This generates a profile for internal use only.
      * We should be generating: Profile version (04300000h), Profile signature (acsp),
      * PCS illumiant field. Likewise mandatory profile tags are omitted.
      */
     write_u32(data, 0, length); // the total length of this memory
--- a/gfx/qcms/src/lib.rs
+++ b/gfx/qcms/src/lib.rs
@@ -33,22 +33,22 @@ impl Default for Intent {
 }
 
 pub(crate) type s15Fixed16Number = i32;
 
 /* produces the nearest float to 'a' with a maximum error
  * of 1/1024 which happens for large values like 0x40000040 */
 #[inline]
 fn s15Fixed16Number_to_float(mut a: s15Fixed16Number) -> f32 {
-    return a as f32 / 65536.0;
+    a as f32 / 65536.0
 }
 
 #[inline]
 fn double_to_s15Fixed16Number(mut v: f64) -> s15Fixed16Number {
-    return (v * 65536f64) as i32;
+    (v * 65536f64) as i32
 }
 
 pub mod c_bindings;
 mod chain;
 mod gtest;
 mod iccread;
 mod matrix;
 mod transform;
--- a/gfx/qcms/src/matrix.rs
+++ b/gfx/qcms/src/matrix.rs
@@ -34,28 +34,28 @@ pub struct vector {
     pub v: [f32; 3],
 }
 
 pub fn matrix_eval(mut mat: matrix, mut v: vector) -> vector {
     let mut result: vector = vector { v: [0.; 3] };
     result.v[0] = mat.m[0][0] * v.v[0] + mat.m[0][1] * v.v[1] + mat.m[0][2] * v.v[2];
     result.v[1] = mat.m[1][0] * v.v[0] + mat.m[1][1] * v.v[1] + mat.m[1][2] * v.v[2];
     result.v[2] = mat.m[2][0] * v.v[0] + mat.m[2][1] * v.v[1] + mat.m[2][2] * v.v[2];
-    return result;
+    result
 }
 //XXX: should probably pass by reference and we could
 //probably reuse this computation in matrix_invert
 pub fn matrix_det(mut mat: matrix) -> f32 {
     let mut det: f32 = mat.m[0][0] * mat.m[1][1] * mat.m[2][2]
         + mat.m[0][1] * mat.m[1][2] * mat.m[2][0]
         + mat.m[0][2] * mat.m[1][0] * mat.m[2][1]
         - mat.m[0][0] * mat.m[1][2] * mat.m[2][1]
         - mat.m[0][1] * mat.m[1][0] * mat.m[2][2]
         - mat.m[0][2] * mat.m[1][1] * mat.m[2][0];
-    return det;
+    det
 }
 /* from pixman and cairo and Mathematics for Game Programmers */
 /* lcms uses gauss-jordan elimination with partial pivoting which is
  * less efficient and not as numerically stable. See Mathematics for
  * Game Programmers. */
 pub fn matrix_invert(mut mat: matrix) -> matrix {
     let mut dest_mat: matrix = matrix {
         m: [[0.; 3]; 3],
@@ -87,39 +87,39 @@ pub fn matrix_invert(mut mat: matrix) ->
             if ((i + j) & 1) != 0 {
                 p = -p
             }
             dest_mat.m[j as usize][i as usize] = (det as f64 * p) as f32;
             i += 1
         }
         j += 1
     }
-    return dest_mat;
+    dest_mat
 }
 pub fn matrix_identity() -> matrix {
     let mut i: matrix = matrix {
         m: [[0.; 3]; 3],
         invalid: false,
     };
     i.m[0][0] = 1.;
     i.m[0][1] = 0.;
     i.m[0][2] = 0.;
     i.m[1][0] = 0.;
     i.m[1][1] = 1.;
     i.m[1][2] = 0.;
     i.m[2][0] = 0.;
     i.m[2][1] = 0.;
     i.m[2][2] = 1.;
     i.invalid = false;
-    return i;
+    i
 }
 pub fn matrix_invalid() -> matrix {
     let mut inv: matrix = matrix_identity();
     inv.invalid = true;
-    return inv;
+    inv
 }
 /* from pixman */
 /* MAT3per... */
 pub fn matrix_multiply(mut a: matrix, mut b: matrix) -> matrix {
     let mut result: matrix = matrix {
         m: [[0.; 3]; 3],
         invalid: false,
     };
@@ -137,10 +137,10 @@ pub fn matrix_multiply(mut a: matrix, mu
                 o += 1
             }
             result.m[dy as usize][dx as usize] = v as f32;
             dx += 1
         }
         dy += 1
     }
     result.invalid = a.invalid as i32 != 0 || b.invalid as i32 != 0;
-    return result;
+    result
 }
--- a/gfx/qcms/src/transform.rs
+++ b/gfx/qcms/src/transform.rs
@@ -198,21 +198,21 @@ impl GrayFormat for Gray {
 pub struct GrayAlpha;
 impl GrayFormat for GrayAlpha {
     const has_alpha: bool = true;
 }
 
 #[inline]
 fn clamp_u8(mut v: f32) -> u8 {
     if v > 255. {
-        return 255;
+        255
     } else if v < 0. {
-        return 0;
+        0
     } else {
-        return (v + 0.5).floor() as u8;
+        (v + 0.5).floor() as u8
     }
 }
 
 // Build a White point, primary chromas transfer matrix from RGB to CIE XYZ
 // This is just an approximation, I am not handling all the non-linear
 // aspects of the RGB to XYZ process, and assumming that the gamma correction
 // has transitive property in the tranformation chain.
 //
@@ -273,17 +273,17 @@ fn build_RGB_to_XYZ_transfer_matrix(
     result.m[0][2] = (coefs.v[2] as f64 * xb) as f32;
     result.m[1][0] = (coefs.v[0] as f64 * yr) as f32;
     result.m[1][1] = (coefs.v[1] as f64 * yg) as f32;
     result.m[1][2] = (coefs.v[2] as f64 * yb) as f32;
     result.m[2][0] = (coefs.v[0] as f64 * (1.0f64 - xr - yr)) as f32;
     result.m[2][1] = (coefs.v[1] as f64 * (1.0f64 - xg - yg)) as f32;
     result.m[2][2] = (coefs.v[2] as f64 * (1.0f64 - xb - yb)) as f32;
     result.invalid = primaries_invert.invalid;
-    return result;
+    result
 }
 /* CIE Illuminant D50 */
 const D50_XYZ: CIE_XYZ = CIE_XYZ {
     X: 0.9642f64,
     Y: 1.0000f64,
     Z: 0.8249f64,
 };
 /* from lcms: xyY2XYZ()
@@ -292,17 +292,17 @@ fn xyY2XYZ(mut source: qcms_CIE_xyY) -> 
     let mut dest: CIE_XYZ = CIE_XYZ {
         X: 0.,
         Y: 0.,
         Z: 0.,
     };
     dest.X = source.x / source.y * source.Y;
     dest.Y = source.Y;
     dest.Z = (1f64 - source.x - source.y) / source.y * source.Y;
-    return dest;
+    dest
 }
 /* from lcms: ComputeChromaticAdaption */
 // Compute chromatic adaption matrix using chad as cone matrix
 fn compute_chromatic_adaption(
     mut source_white_point: CIE_XYZ,
     mut dest_white_point: CIE_XYZ,
     mut chad: matrix,
 ) -> matrix {
@@ -335,47 +335,47 @@ fn compute_chromatic_adaption(
     cone.m[1][0] = 0.;
     cone.m[1][1] = cone_dest_rgb.v[1] / cone_source_rgb.v[1];
     cone.m[1][2] = 0.;
     cone.m[2][0] = 0.;
     cone.m[2][1] = 0.;
     cone.m[2][2] = cone_dest_rgb.v[2] / cone_source_rgb.v[2];
     cone.invalid = false;
     // Normalize
-    return matrix_multiply(chad_inv, matrix_multiply(cone, chad));
+    matrix_multiply(chad_inv, matrix_multiply(cone, chad))
 }
 /* from lcms: cmsAdaptionMatrix */
 // Returns the final chrmatic adaptation from illuminant FromIll to Illuminant ToIll
 // Bradford is assumed
 fn adaption_matrix(mut source_illumination: CIE_XYZ, mut target_illumination: CIE_XYZ) -> matrix {
     let mut lam_rigg: matrix = {
         let mut init = matrix {
             m: [
                 [0.8951, 0.2664, -0.1614],
                 [-0.7502, 1.7135, 0.0367],
                 [0.0389, -0.0685, 1.0296],
             ],
             invalid: false,
         };
         init
     };
-    return compute_chromatic_adaption(source_illumination, target_illumination, lam_rigg);
+    compute_chromatic_adaption(source_illumination, target_illumination, lam_rigg)
 }
 /* from lcms: cmsAdaptMatrixToD50 */
 fn adapt_matrix_to_D50(mut r: matrix, mut source_white_pt: qcms_CIE_xyY) -> matrix {
     if source_white_pt.y == 0.0f64 {
         return matrix_invalid();
     }
 
     let mut Dn: CIE_XYZ = xyY2XYZ(source_white_pt);
     let mut Bradford: matrix = adaption_matrix(Dn, D50_XYZ);
     if Bradford.invalid {
         return matrix_invalid();
     }
-    return matrix_multiply(Bradford, r);
+    matrix_multiply(Bradford, r)
 }
 pub(crate) fn set_rgb_colorants(
     mut profile: &mut qcms_profile,
     mut white_point: qcms_CIE_xyY,
     mut primaries: qcms_CIE_xyYTRIPLE,
 ) -> bool {
     let mut colorants: matrix = build_RGB_to_XYZ_transfer_matrix(white_point, primaries);
     colorants = adapt_matrix_to_D50(colorants, white_point);
@@ -387,26 +387,26 @@ pub(crate) fn set_rgb_colorants(
     profile.redColorant.Y = double_to_s15Fixed16Number(colorants.m[1][0] as f64);
     profile.redColorant.Z = double_to_s15Fixed16Number(colorants.m[2][0] as f64);
     profile.greenColorant.X = double_to_s15Fixed16Number(colorants.m[0][1] as f64);
     profile.greenColorant.Y = double_to_s15Fixed16Number(colorants.m[1][1] as f64);
     profile.greenColorant.Z = double_to_s15Fixed16Number(colorants.m[2][1] as f64);
     profile.blueColorant.X = double_to_s15Fixed16Number(colorants.m[0][2] as f64);
     profile.blueColorant.Y = double_to_s15Fixed16Number(colorants.m[1][2] as f64);
     profile.blueColorant.Z = double_to_s15Fixed16Number(colorants.m[2][2] as f64);
-    return true;
+    true
 }
 pub(crate) fn get_rgb_colorants(
     mut colorants: &mut matrix,
     mut white_point: qcms_CIE_xyY,
     mut primaries: qcms_CIE_xyYTRIPLE,
 ) -> bool {
     *colorants = build_RGB_to_XYZ_transfer_matrix(white_point, primaries);
     *colorants = adapt_matrix_to_D50(*colorants, white_point);
-    return if colorants.invalid { true } else { false };
+    colorants.invalid
 }
 /* Alpha is not corrected.
    A rationale for this is found in Alvy Ray's "Should Alpha Be Nonlinear If
    RGB Is?" Tech Memo 17 (December 14, 1998).
     See: ftp://ftp.alvyray.com/Acrobat/17_Nonln.pdf
 */
 unsafe extern "C" fn qcms_transform_data_gray_template_lut<I: GrayFormat, F: Format>(
     mut transform: *const qcms_transform,
@@ -441,24 +441,24 @@ unsafe extern "C" fn qcms_transform_data
         let mut out_device_g: f32 = lut_interp_linear(
             linear as f64,
             &(*transform).output_gamma_lut_g.as_ref().unwrap(),
         );
         let mut out_device_b: f32 = lut_interp_linear(
             linear as f64,
             &(*transform).output_gamma_lut_b.as_ref().unwrap(),
         );
-        *dest.offset(F::kRIndex as isize) = clamp_u8(out_device_r * 255f32);
-        *dest.offset(F::kGIndex as isize) = clamp_u8(out_device_g * 255f32);
-        *dest.offset(F::kBIndex as isize) = clamp_u8(out_device_b * 255f32);
+        *dest.add(F::kRIndex) = clamp_u8(out_device_r * 255f32);
+        *dest.add(F::kGIndex) = clamp_u8(out_device_g * 255f32);
+        *dest.add(F::kBIndex) = clamp_u8(out_device_b * 255f32);
         if F::kAIndex != 0xff {
-            *dest.offset(F::kAIndex as isize) = alpha
+            *dest.add(F::kAIndex) = alpha
         }
         dest = dest.offset(components as isize);
-        i = i + 1
+        i += 1
     }
 }
 unsafe extern "C" fn qcms_transform_data_gray_out_lut(
     mut transform: *const qcms_transform,
     mut src: *const libc::c_uchar,
     mut dest: *mut libc::c_uchar,
     mut length: usize,
 ) {
@@ -523,24 +523,24 @@ unsafe extern "C" fn qcms_transform_data
             let fresh3 = src;
             src = src.offset(1);
             alpha = *fresh3
         }
 
         let mut linear: f32 = *input_gamma_table_gray.offset(device as isize);
         /* we could round here... */
         let mut gray: u16 = (linear * PRECACHE_OUTPUT_MAX as f32) as u16;
-        *dest.offset(F::kRIndex as isize) = (output_table_r).data[gray as usize];
-        *dest.offset(F::kGIndex as isize) = (output_table_g).data[gray as usize];
-        *dest.offset(F::kBIndex as isize) = (output_table_b).data[gray as usize];
+        *dest.add(F::kRIndex) = (output_table_r).data[gray as usize];
+        *dest.add(F::kGIndex) = (output_table_g).data[gray as usize];
+        *dest.add(F::kBIndex) = (output_table_b).data[gray as usize];
         if F::kAIndex != 0xff {
-            *dest.offset(F::kAIndex as isize) = alpha
+            *dest.add(F::kAIndex) = alpha
         }
         dest = dest.offset(components as isize);
-        i = i + 1
+        i += 1
     }
 }
 unsafe extern "C" fn qcms_transform_data_gray_out_precache(
     mut transform: *const qcms_transform,
     mut src: *const libc::c_uchar,
     mut dest: *mut libc::c_uchar,
     mut length: usize,
 ) {
@@ -590,22 +590,22 @@ unsafe extern "C" fn qcms_transform_data
     let output_table_b = ((*transform).output_table_b).as_deref().unwrap();
     let input_gamma_table_r = (*transform).input_gamma_table_r.as_ref().unwrap().as_ptr();
     let input_gamma_table_g = (*transform).input_gamma_table_g.as_ref().unwrap().as_ptr();
     let input_gamma_table_b = (*transform).input_gamma_table_b.as_ref().unwrap().as_ptr();
 
     let mut mat: *const [f32; 4] = (*transform).matrix.as_ptr();
     let mut i: libc::c_uint = 0;
     while (i as usize) < length {
-        let mut device_r: libc::c_uchar = *src.offset(F::kRIndex as isize);
-        let mut device_g: libc::c_uchar = *src.offset(F::kGIndex as isize);
-        let mut device_b: libc::c_uchar = *src.offset(F::kBIndex as isize);
+        let mut device_r: libc::c_uchar = *src.add(F::kRIndex);
+        let mut device_g: libc::c_uchar = *src.add(F::kGIndex);
+        let mut device_b: libc::c_uchar = *src.add(F::kBIndex);
         let mut alpha: libc::c_uchar = 0;
         if F::kAIndex != 0xff {
-            alpha = *src.offset(F::kAIndex as isize)
+            alpha = *src.add(F::kAIndex)
         }
         src = src.offset(components as isize);
 
         let mut linear_r: f32 = *input_gamma_table_r.offset(device_r as isize);
         let mut linear_g: f32 = *input_gamma_table_g.offset(device_g as isize);
         let mut linear_b: f32 = *input_gamma_table_b.offset(device_b as isize);
         let mut out_linear_r: f32 = (*mat.offset(0isize))[0] * linear_r
             + (*mat.offset(1isize))[0] * linear_g
@@ -619,24 +619,24 @@ unsafe extern "C" fn qcms_transform_data
         out_linear_r = clamp_float(out_linear_r);
         out_linear_g = clamp_float(out_linear_g);
         out_linear_b = clamp_float(out_linear_b);
         /* we could round here... */
 
         let mut r: u16 = (out_linear_r * PRECACHE_OUTPUT_MAX as f32) as u16;
         let mut g: u16 = (out_linear_g * PRECACHE_OUTPUT_MAX as f32) as u16;
         let mut b: u16 = (out_linear_b * PRECACHE_OUTPUT_MAX as f32) as u16;
-        *dest.offset(F::kRIndex as isize) = (output_table_r).data[r as usize];
-        *dest.offset(F::kGIndex as isize) = (output_table_g).data[g as usize];
-        *dest.offset(F::kBIndex as isize) = (output_table_b).data[b as usize];
+        *dest.add(F::kRIndex) = (output_table_r).data[r as usize];
+        *dest.add(F::kGIndex) = (output_table_g).data[g as usize];
+        *dest.add(F::kBIndex) = (output_table_b).data[b as usize];
         if F::kAIndex != 0xff {
-            *dest.offset(F::kAIndex as isize) = alpha
+            *dest.add(F::kAIndex) = alpha
         }
         dest = dest.offset(components as isize);
-        i = i + 1
+        i += 1
     }
 }
 #[no_mangle]
 pub unsafe extern "C" fn qcms_transform_data_rgb_out_lut_precache(
     mut transform: *const qcms_transform,
     mut src: *const libc::c_uchar,
     mut dest: *mut libc::c_uchar,
     mut length: usize,
@@ -714,17 +714,17 @@ static void qcms_transform_data_clut(con
 
         *dest++ = clamp_u8(clut_r*255.0f);
         *dest++ = clamp_u8(clut_g*255.0f);
         *dest++ = clamp_u8(clut_b*255.0f);
     }
 }
 */
 fn int_div_ceil(mut value: i32, mut div: i32) -> i32 {
-    return (value + div - 1) / div;
+    (value + div - 1) / div
 }
 // Using lcms' tetra interpolation algorithm.
 unsafe extern "C" fn qcms_transform_data_tetra_clut_template<F: Format>(
     mut transform: *const qcms_transform,
     mut src: *const libc::c_uchar,
     mut dest: *mut libc::c_uchar,
     mut length: usize,
 ) {
@@ -749,22 +749,22 @@ unsafe extern "C" fn qcms_transform_data
     let mut c1_b: f32;
     let mut c2_b: f32;
     let mut c3_b: f32;
     let mut clut_r: f32;
     let mut clut_g: f32;
     let mut clut_b: f32;
     let mut i: libc::c_uint = 0;
     while (i as usize) < length {
-        let mut in_r: libc::c_uchar = *src.offset(F::kRIndex as isize);
-        let mut in_g: libc::c_uchar = *src.offset(F::kGIndex as isize);
-        let mut in_b: libc::c_uchar = *src.offset(F::kBIndex as isize);
+        let mut in_r: libc::c_uchar = *src.add(F::kRIndex);
+        let mut in_g: libc::c_uchar = *src.add(F::kGIndex);
+        let mut in_b: libc::c_uchar = *src.add(F::kBIndex);
         let mut in_a: libc::c_uchar = 0;
         if F::kAIndex != 0xff {
-            in_a = *src.offset(F::kAIndex as isize)
+            in_a = *src.add(F::kAIndex)
         }
         src = src.offset(components as isize);
         let mut linear_r: f32 = in_r as i32 as f32 / 255.0;
         let mut linear_g: f32 = in_g as i32 as f32 / 255.0;
         let mut linear_b: f32 = in_b as i32 as f32 / 255.0;
         let mut x: i32 = in_r as i32 * ((*transform).grid_size as i32 - 1) / 255;
         let mut y: i32 = in_g as i32 * ((*transform).grid_size as i32 - 1) / 255;
         let mut z: i32 = in_b as i32 * ((*transform).grid_size as i32 - 1) / 255;
@@ -878,24 +878,24 @@ unsafe extern "C" fn qcms_transform_data
                 - *b_table.offset(((x * len + y_n * x_len + z_n * xy_len) * 3) as isize);
             c2_b = *b_table.offset(((x * len + y_n * x_len + z_n * xy_len) * 3) as isize)
                 - *b_table.offset(((x * len + y * x_len + z_n * xy_len) * 3) as isize);
             c3_b = *b_table.offset(((x * len + y * x_len + z_n * xy_len) * 3) as isize) - c0_b
         }
         clut_r = c0_r + c1_r * rx + c2_r * ry + c3_r * rz;
         clut_g = c0_g + c1_g * rx + c2_g * ry + c3_g * rz;
         clut_b = c0_b + c1_b * rx + c2_b * ry + c3_b * rz;
-        *dest.offset(F::kRIndex as isize) = clamp_u8(clut_r * 255.0);
-        *dest.offset(F::kGIndex as isize) = clamp_u8(clut_g * 255.0);
-        *dest.offset(F::kBIndex as isize) = clamp_u8(clut_b * 255.0);
+        *dest.add(F::kRIndex) = clamp_u8(clut_r * 255.0);
+        *dest.add(F::kGIndex) = clamp_u8(clut_g * 255.0);
+        *dest.add(F::kBIndex) = clamp_u8(clut_b * 255.0);
         if F::kAIndex != 0xff {
-            *dest.offset(F::kAIndex as isize) = in_a
+            *dest.add(F::kAIndex) = in_a
         }
         dest = dest.offset(components as isize);
-        i = i + 1
+        i += 1
     }
 }
 unsafe extern "C" fn qcms_transform_data_tetra_clut_rgb(
     mut transform: *const qcms_transform,
     mut src: *const libc::c_uchar,
     mut dest: *mut libc::c_uchar,
     mut length: usize,
 ) {
@@ -926,22 +926,22 @@ unsafe extern "C" fn qcms_transform_data
     let components: libc::c_uint = if F::kAIndex == 0xff { 3 } else { 4 } as libc::c_uint;
 
     let mut mat: *const [f32; 4] = (*transform).matrix.as_ptr();
     let mut i: libc::c_uint = 0;
     let input_gamma_table_r = (*transform).input_gamma_table_r.as_ref().unwrap().as_ptr();
     let input_gamma_table_g = (*transform).input_gamma_table_g.as_ref().unwrap().as_ptr();
     let input_gamma_table_b = (*transform).input_gamma_table_b.as_ref().unwrap().as_ptr();
     while (i as usize) < length {
-        let mut device_r: libc::c_uchar = *src.offset(F::kRIndex as isize);
-        let mut device_g: libc::c_uchar = *src.offset(F::kGIndex as isize);
-        let mut device_b: libc::c_uchar = *src.offset(F::kBIndex as isize);
+        let mut device_r: libc::c_uchar = *src.add(F::kRIndex);
+        let mut device_g: libc::c_uchar = *src.add(F::kGIndex);
+        let mut device_b: libc::c_uchar = *src.add(F::kBIndex);
         let mut alpha: libc::c_uchar = 0;
         if F::kAIndex != 0xff {
-            alpha = *src.offset(F::kAIndex as isize)
+            alpha = *src.add(F::kAIndex)
         }
         src = src.offset(components as isize);
 
         let mut linear_r: f32 = *input_gamma_table_r.offset(device_r as isize);
         let mut linear_g: f32 = *input_gamma_table_g.offset(device_g as isize);
         let mut linear_b: f32 = *input_gamma_table_b.offset(device_b as isize);
         let mut out_linear_r: f32 = (*mat.offset(0isize))[0] * linear_r
             + (*mat.offset(1isize))[0] * linear_g
@@ -963,24 +963,24 @@ unsafe extern "C" fn qcms_transform_data
         let mut out_device_g: f32 = lut_interp_linear(
             out_linear_g as f64,
             (*transform).output_gamma_lut_g.as_ref().unwrap(),
         );
         let mut out_device_b: f32 = lut_interp_linear(
             out_linear_b as f64,
             (*transform).output_gamma_lut_b.as_ref().unwrap(),
         );
-        *dest.offset(F::kRIndex as isize) = clamp_u8(out_device_r * 255f32);
-        *dest.offset(F::kGIndex as isize) = clamp_u8(out_device_g * 255f32);
-        *dest.offset(F::kBIndex as isize) = clamp_u8(out_device_b * 255f32);
+        *dest.add(F::kRIndex) = clamp_u8(out_device_r * 255f32);
+        *dest.add(F::kGIndex) = clamp_u8(out_device_g * 255f32);
+        *dest.add(F::kBIndex) = clamp_u8(out_device_b * 255f32);
         if F::kAIndex != 0xff {
-            *dest.offset(F::kAIndex as isize) = alpha
+            *dest.add(F::kAIndex) = alpha
         }
         dest = dest.offset(components as isize);
-        i = i + 1
+        i += 1
     }
 }
 #[no_mangle]
 pub unsafe extern "C" fn qcms_transform_data_rgb_out_lut(
     mut transform: *const qcms_transform,
     mut src: *const libc::c_uchar,
     mut dest: *mut libc::c_uchar,
     mut length: usize,
@@ -1047,34 +1047,34 @@ fn compute_whitepoint_adaption(mut X: f3
     let mut b: f32 = (0.96422 * bradford_matrix.m[0][2]
         + 1.000 * bradford_matrix.m[1][2]
         + 0.82521 * bradford_matrix.m[2][2])
         / (X * bradford_matrix.m[0][2] + Y * bradford_matrix.m[1][2] + Z * bradford_matrix.m[2][2]);
     let mut white_adaption = matrix {
         m: [[p, 0., 0.], [0., y, 0.], [0., 0., b]],
         invalid: false,
     };
-    return matrix_multiply(
+    matrix_multiply(
         bradford_matrix_inv,
         matrix_multiply(white_adaption, bradford_matrix),
-    );
+    )
 }
 #[no_mangle]
 pub extern "C" fn qcms_profile_precache_output_transform(mut profile: &mut qcms_profile) {
     /* we only support precaching on rgb profiles */
     if profile.color_space != RGB_SIGNATURE {
         return;
     }
     if qcms_supports_iccv4.load(Ordering::Relaxed) {
         /* don't precache since we will use the B2A LUT */
-        if !profile.B2A0.is_none() {
+        if profile.B2A0.is_some() {
             return;
         }
         /* don't precache since we will use the mBA LUT */
-        if !profile.mBA.is_none() {
+        if profile.mBA.is_some() {
             return;
         }
     }
     /* don't precache if we do not have the TRC curves */
     if profile.redTRC.is_none() || profile.greenTRC.is_none() || profile.blueTRC.is_none() {
         return;
     }
     if profile.output_table_r.is_none() {
@@ -1143,60 +1143,54 @@ fn transform_precacheLUT_float(
         } else if in_type == DATA_RGB_8 {
             (*transform).transform_fn = Some(qcms_transform_data_tetra_clut_rgb)
         }
         debug_assert!((*transform).transform_fn.is_some());
     } else {
         return None;
     }
 
-    return Some(transform);
+    Some(transform)
 }
 
 pub fn transform_create(
     mut in_0: &qcms_profile,
     mut in_type: qcms_data_type,
     mut out: &qcms_profile,
     mut out_type: qcms_data_type,
     mut intent: Intent,
 ) -> Option<Box<qcms_transform>> {
     // Ensure the requested input and output types make sense.
     let matching_format = match (in_type, out_type) {
         (DATA_RGB_8, DATA_RGB_8) => true,
         (DATA_RGBA_8, DATA_RGBA_8) => true,
         (DATA_BGRA_8, DATA_BGRA_8) => true,
-        (DATA_GRAY_8, out_type) => match out_type {
-            DATA_RGB_8 | DATA_RGBA_8 | DATA_BGRA_8 => true,
-            _ => false,
-        },
-        (DATA_GRAYA_8, out_type) => match out_type {
-            DATA_RGBA_8 | DATA_BGRA_8 => true,
-            _ => false,
-        },
+        (DATA_GRAY_8, out_type) => matches!(out_type, DATA_RGB_8 | DATA_RGBA_8 | DATA_BGRA_8),
+        (DATA_GRAYA_8, out_type) => matches!(out_type, DATA_RGBA_8 | DATA_BGRA_8),
         _ => false,
     };
     if !matching_format {
         debug_assert!(false, "input/output type");
         return None;
     }
     let mut transform: Box<qcms_transform> = Box::new(Default::default());
     let mut precache: bool = false;
-    if !out.output_table_r.is_none()
-        && !out.output_table_g.is_none()
-        && !out.output_table_b.is_none()
+    if out.output_table_r.is_some()
+        && out.output_table_g.is_some()
+        && out.output_table_b.is_some()
     {
         precache = true
     }
     // This precache assumes RGB_SIGNATURE (fails on GRAY_SIGNATURE, for instance)
     if qcms_supports_iccv4.load(Ordering::Relaxed) as i32 != 0
         && (in_type == DATA_RGB_8 || in_type == DATA_RGBA_8 || in_type == DATA_BGRA_8)
-        && (!in_0.A2B0.is_none()
-            || !out.B2A0.is_none()
-            || !in_0.mAB.is_none()
-            || !out.mAB.is_none())
+        && (in_0.A2B0.is_some()
+            || out.B2A0.is_some()
+            || in_0.mAB.is_some()
+            || out.mAB.is_some())
     {
         // Precache the transformation to a CLUT 33x33x33 in size.
         // 33 is used by many profiles and works well in pratice.
         // This evenly divides 256 into blocks of 8x8x8.
         // TODO For transforming small data sets of about 200x200 or less
         // precaching should be avoided.
         let mut result = transform_precacheLUT_float(transform, in_0, out, 33, in_type);
         debug_assert!(result.is_some(), "precacheLUT failed");
@@ -1296,36 +1290,34 @@ pub fn transform_create(
         /* check for NaN values in the matrix and bail if we find any */
         let mut i: libc::c_uint = 0;
         while i < 3 {
             let mut j: libc::c_uint = 0;
             while j < 3 {
                 if result_0.m[i as usize][j as usize] != result_0.m[i as usize][j as usize] {
                     return None;
                 }
-                j = j + 1
+                j += 1
             }
-            i = i + 1
+            i += 1
         }
         /* store the results in column major mode
          * this makes doing the multiplication with sse easier */
         transform.matrix[0][0] = result_0.m[0][0];
         transform.matrix[1][0] = result_0.m[0][1];
         transform.matrix[2][0] = result_0.m[0][2];
         transform.matrix[0][1] = result_0.m[1][0];
         transform.matrix[1][1] = result_0.m[1][1];
         transform.matrix[2][1] = result_0.m[1][2];
         transform.matrix[0][2] = result_0.m[2][0];
         transform.matrix[1][2] = result_0.m[2][1];
         transform.matrix[2][2] = result_0.m[2][2]
     } else if in_0.color_space == GRAY_SIGNATURE {
         transform.input_gamma_table_gray = build_input_gamma_table(in_0.grayTRC.as_deref());
-        if transform.input_gamma_table_gray.is_none() {
-            return None;
-        }
+        transform.input_gamma_table_gray.as_ref()?;
         if precache {
             if out_type == DATA_RGB_8 {
                 transform.transform_fn = Some(qcms_transform_data_gray_out_precache)
             } else if out_type == DATA_RGBA_8 {
                 if in_type == DATA_GRAY_8 {
                     transform.transform_fn = Some(qcms_transform_data_gray_rgba_out_precache)
                 } else {
                     transform.transform_fn = Some(qcms_transform_data_graya_rgba_out_precache)
@@ -1352,17 +1344,17 @@ pub fn transform_create(
                 transform.transform_fn = Some(qcms_transform_data_graya_bgra_out_lut)
             }
         }
     } else {
         debug_assert!(false, "unexpected colorspace");
         return None;
     }
     debug_assert!(transform.transform_fn.is_some());
-    return Some(transform);
+    Some(transform)
 }
 #[no_mangle]
 pub unsafe extern "C" fn qcms_transform_data(
     mut transform: &qcms_transform,
     mut src: *const libc::c_void,
     mut dest: *mut libc::c_void,
     mut length: usize,
 ) {
--- a/gfx/qcms/src/transform_avx.rs
+++ b/gfx/qcms/src/transform_avx.rs
@@ -79,135 +79,135 @@ unsafe extern "C" fn qcms_transform_data
     let mut alpha2: libc::c_uchar = 0;
     /* CYA */
     if length == 0 {
         return;
     }
     /* If there are at least 2 pixels, then we can load their components into
     a single 256-bit register for processing. */
     if length > 1 {
-        vec_r0 = _mm_broadcast_ss(&*igtbl_r.offset(*src.offset(F::kRIndex as isize) as isize));
-        vec_g0 = _mm_broadcast_ss(&*igtbl_g.offset(*src.offset(F::kGIndex as isize) as isize));
-        vec_b0 = _mm_broadcast_ss(&*igtbl_b.offset(*src.offset(F::kBIndex as isize) as isize));
+        vec_r0 = _mm_broadcast_ss(&*igtbl_r.offset(*src.add(F::kRIndex) as isize));
+        vec_g0 = _mm_broadcast_ss(&*igtbl_g.offset(*src.add(F::kGIndex) as isize));
+        vec_b0 = _mm_broadcast_ss(&*igtbl_b.offset(*src.add(F::kBIndex) as isize));
         vec_r1 = _mm_broadcast_ss(
-            &*igtbl_r.offset(*src.offset((F::kRIndex + components as usize) as isize) as isize),
+            &*igtbl_r.offset(*src.add(F::kRIndex + components as usize) as isize),
         );
         vec_g1 = _mm_broadcast_ss(
-            &*igtbl_g.offset(*src.offset((F::kGIndex + components as usize) as isize) as isize),
+            &*igtbl_g.offset(*src.add(F::kGIndex + components as usize) as isize),
         );
         vec_b1 = _mm_broadcast_ss(
-            &*igtbl_b.offset(*src.offset((F::kBIndex + components as usize) as isize) as isize),
+            &*igtbl_b.offset(*src.add(F::kBIndex + components as usize) as isize),
         );
         vec_r = _mm256_insertf128_ps(_mm256_castps128_ps256(vec_r0), vec_r1, 1);
         vec_g = _mm256_insertf128_ps(_mm256_castps128_ps256(vec_g0), vec_g1, 1);
         vec_b = _mm256_insertf128_ps(_mm256_castps128_ps256(vec_b0), vec_b1, 1);
         if F::kAIndex != 0xff {
-            alpha1 = *src.offset(F::kAIndex as isize);
-            alpha2 = *src.offset((F::kAIndex + components as usize) as isize)
+            alpha1 = *src.add(F::kAIndex);
+            alpha2 = *src.add(F::kAIndex + components as usize)
         }
     }
     /* If there are at least 4 pixels, then we can iterate and preload the
     next 2 while we store the result of the current 2. */
     while length > 3 {
         /* Ensure we are pointing at the next 2 pixels for the next load. */
         src = src.offset((2 * components) as isize);
         /* gamma * matrix */
         vec_r = _mm256_mul_ps(vec_r, mat0);
         vec_g = _mm256_mul_ps(vec_g, mat1);
         vec_b = _mm256_mul_ps(vec_b, mat2);
         /* store alpha for these pixels; load alpha for next two */
         if F::kAIndex != 0xff {
-            *dest.offset(F::kAIndex as isize) = alpha1;
-            *dest.offset((F::kAIndex + components as usize) as isize) = alpha2;
-            alpha1 = *src.offset(F::kAIndex as isize);
-            alpha2 = *src.offset((F::kAIndex + components as usize) as isize)
+            *dest.add(F::kAIndex) = alpha1;
+            *dest.add(F::kAIndex + components as usize) = alpha2;
+            alpha1 = *src.add(F::kAIndex);
+            alpha2 = *src.add(F::kAIndex + components as usize)
         }
         /* crunch, crunch, crunch */
         vec_r = _mm256_add_ps(vec_r, _mm256_add_ps(vec_g, vec_b));
         vec_r = _mm256_max_ps(min, vec_r);
         vec_r = _mm256_min_ps(max, vec_r);
         result = _mm256_mul_ps(vec_r, scale);
         /* store calc'd output tables indices */
         _mm256_store_si256(output as *mut __m256i, _mm256_cvtps_epi32(result));
         /* load gamma values for next loop while store completes */
-        vec_r0 = _mm_broadcast_ss(&*igtbl_r.offset(*src.offset(F::kRIndex as isize) as isize));
-        vec_g0 = _mm_broadcast_ss(&*igtbl_g.offset(*src.offset(F::kGIndex as isize) as isize));
-        vec_b0 = _mm_broadcast_ss(&*igtbl_b.offset(*src.offset(F::kBIndex as isize) as isize));
+        vec_r0 = _mm_broadcast_ss(&*igtbl_r.offset(*src.add(F::kRIndex) as isize));
+        vec_g0 = _mm_broadcast_ss(&*igtbl_g.offset(*src.add(F::kGIndex) as isize));
+        vec_b0 = _mm_broadcast_ss(&*igtbl_b.offset(*src.add(F::kBIndex) as isize));
         vec_r1 = _mm_broadcast_ss(
-            &*igtbl_r.offset(*src.offset((F::kRIndex + components as usize) as isize) as isize),
+            &*igtbl_r.offset(*src.add(F::kRIndex + components as usize) as isize),
         );
         vec_g1 = _mm_broadcast_ss(
-            &*igtbl_g.offset(*src.offset((F::kGIndex + components as usize) as isize) as isize),
+            &*igtbl_g.offset(*src.add(F::kGIndex + components as usize) as isize),
         );
         vec_b1 = _mm_broadcast_ss(
-            &*igtbl_b.offset(*src.offset((F::kBIndex + components as usize) as isize) as isize),
+            &*igtbl_b.offset(*src.add(F::kBIndex + components as usize) as isize),
         );
         vec_r = _mm256_insertf128_ps(_mm256_castps128_ps256(vec_r0), vec_r1, 1);
         vec_g = _mm256_insertf128_ps(_mm256_castps128_ps256(vec_g0), vec_g1, 1);
         vec_b = _mm256_insertf128_ps(_mm256_castps128_ps256(vec_b0), vec_b1, 1);
         /* use calc'd indices to output RGB values */
-        *dest.offset(F::kRIndex as isize) = *otdata_r.offset(*output.offset(0isize) as isize);
-        *dest.offset(F::kGIndex as isize) = *otdata_g.offset(*output.offset(1isize) as isize);
-        *dest.offset(F::kBIndex as isize) = *otdata_b.offset(*output.offset(2isize) as isize);
-        *dest.offset((F::kRIndex + components as usize) as isize) =
+        *dest.add(F::kRIndex) = *otdata_r.offset(*output.offset(0isize) as isize);
+        *dest.add(F::kGIndex) = *otdata_g.offset(*output.offset(1isize) as isize);
+        *dest.add(F::kBIndex) = *otdata_b.offset(*output.offset(2isize) as isize);
+        *dest.add(F::kRIndex + components as usize) =
             *otdata_r.offset(*output.offset(4isize) as isize);
-        *dest.offset((F::kGIndex + components as usize) as isize) =
+        *dest.add(F::kGIndex + components as usize) =
             *otdata_g.offset(*output.offset(5isize) as isize);
-        *dest.offset((F::kBIndex + components as usize) as isize) =
+        *dest.add(F::kBIndex + components as usize) =
             *otdata_b.offset(*output.offset(6isize) as isize);
         dest = dest.offset((2 * components) as isize);
-        length = length - 2
+        length -= 2
     }
     /* There are 0-3 pixels remaining. If there are 2-3 remaining, then we know
     we have already populated the necessary registers to start the transform. */
     if length > 1 {
         vec_r = _mm256_mul_ps(vec_r, mat0);
         vec_g = _mm256_mul_ps(vec_g, mat1);
         vec_b = _mm256_mul_ps(vec_b, mat2);
         if F::kAIndex != 0xff {
-            *dest.offset(F::kAIndex as isize) = alpha1;
-            *dest.offset((F::kAIndex + components as usize) as isize) = alpha2
+            *dest.add(F::kAIndex) = alpha1;
+            *dest.add(F::kAIndex + components as usize) = alpha2
         }
         vec_r = _mm256_add_ps(vec_r, _mm256_add_ps(vec_g, vec_b));
         vec_r = _mm256_max_ps(min, vec_r);
         vec_r = _mm256_min_ps(max, vec_r);
         result = _mm256_mul_ps(vec_r, scale);
         _mm256_store_si256(output as *mut __m256i, _mm256_cvtps_epi32(result));
-        *dest.offset(F::kRIndex as isize) = *otdata_r.offset(*output.offset(0isize) as isize);
-        *dest.offset(F::kGIndex as isize) = *otdata_g.offset(*output.offset(1isize) as isize);
-        *dest.offset(F::kBIndex as isize) = *otdata_b.offset(*output.offset(2isize) as isize);
-        *dest.offset((F::kRIndex + components as usize) as isize) =
+        *dest.add(F::kRIndex) = *otdata_r.offset(*output.offset(0isize) as isize);
+        *dest.add(F::kGIndex) = *otdata_g.offset(*output.offset(1isize) as isize);
+        *dest.add(F::kBIndex) = *otdata_b.offset(*output.offset(2isize) as isize);
+        *dest.add(F::kRIndex + components as usize) =
             *otdata_r.offset(*output.offset(4isize) as isize);
-        *dest.offset((F::kGIndex + components as usize) as isize) =
+        *dest.add(F::kGIndex + components as usize) =
             *otdata_g.offset(*output.offset(5isize) as isize);
-        *dest.offset((F::kBIndex + components as usize) as isize) =
+        *dest.add(F::kBIndex + components as usize) =
             *otdata_b.offset(*output.offset(6isize) as isize);
         src = src.offset((2 * components) as isize);
         dest = dest.offset((2 * components) as isize);
-        length = length - 2
+        length -= 2
     }
     /* There may be 0-1 pixels remaining. */
     if length == 1 {
-        vec_r0 = _mm_broadcast_ss(&*igtbl_r.offset(*src.offset(F::kRIndex as isize) as isize));
-        vec_g0 = _mm_broadcast_ss(&*igtbl_g.offset(*src.offset(F::kGIndex as isize) as isize));
-        vec_b0 = _mm_broadcast_ss(&*igtbl_b.offset(*src.offset(F::kBIndex as isize) as isize));
+        vec_r0 = _mm_broadcast_ss(&*igtbl_r.offset(*src.add(F::kRIndex) as isize));
+        vec_g0 = _mm_broadcast_ss(&*igtbl_g.offset(*src.add(F::kGIndex) as isize));
+        vec_b0 = _mm_broadcast_ss(&*igtbl_b.offset(*src.add(F::kBIndex) as isize));
         vec_r0 = _mm_mul_ps(vec_r0, _mm256_castps256_ps128(mat0));
         vec_g0 = _mm_mul_ps(vec_g0, _mm256_castps256_ps128(mat1));
         vec_b0 = _mm_mul_ps(vec_b0, _mm256_castps256_ps128(mat2));
         if F::kAIndex != 0xff {
-            *dest.offset(F::kAIndex as isize) = *src.offset(F::kAIndex as isize)
+            *dest.add(F::kAIndex) = *src.add(F::kAIndex)
         }
         vec_r0 = _mm_add_ps(vec_r0, _mm_add_ps(vec_g0, vec_b0));
         vec_r0 = _mm_max_ps(_mm256_castps256_ps128(min), vec_r0);
         vec_r0 = _mm_min_ps(_mm256_castps256_ps128(max), vec_r0);
         vec_r0 = _mm_mul_ps(vec_r0, _mm256_castps256_ps128(scale));
         _mm_store_si128(output as *mut __m128i, _mm_cvtps_epi32(vec_r0));
-        *dest.offset(F::kRIndex as isize) = *otdata_r.offset(*output.offset(0isize) as isize);
-        *dest.offset(F::kGIndex as isize) = *otdata_g.offset(*output.offset(1isize) as isize);
-        *dest.offset(F::kBIndex as isize) = *otdata_b.offset(*output.offset(2isize) as isize)
+        *dest.add(F::kRIndex) = *otdata_r.offset(*output.offset(0isize) as isize);
+        *dest.add(F::kGIndex) = *otdata_g.offset(*output.offset(1isize) as isize);
+        *dest.add(F::kBIndex) = *otdata_b.offset(*output.offset(2isize) as isize)
     };
 }
 #[no_mangle]
 #[target_feature(enable = "avx")]
 pub unsafe extern "C" fn qcms_transform_data_rgb_out_lut_avx(
     mut transform: *const qcms_transform,
     mut src: *const libc::c_uchar,
     mut dest: *mut libc::c_uchar,
--- a/gfx/qcms/src/transform_sse2.rs
+++ b/gfx/qcms/src/transform_sse2.rs
@@ -63,77 +63,77 @@ unsafe extern "C" fn qcms_transform_data
     let mut vec_b: __m128;
     let mut result: __m128;
     let mut alpha: libc::c_uchar = 0;
     /* CYA */
     if length == 0 {
         return;
     }
     /* one pixel is handled outside of the loop */
-    length = length - 1;
+    length -= 1;
     /* setup for transforming 1st pixel */
-    vec_r = _mm_load_ss(&*igtbl_r.offset(*src.offset(F::kRIndex as isize) as isize));
-    vec_g = _mm_load_ss(&*igtbl_g.offset(*src.offset(F::kGIndex as isize) as isize));
-    vec_b = _mm_load_ss(&*igtbl_b.offset(*src.offset(F::kBIndex as isize) as isize));
+    vec_r = _mm_load_ss(&*igtbl_r.offset(*src.add(F::kRIndex) as isize));
+    vec_g = _mm_load_ss(&*igtbl_g.offset(*src.add(F::kGIndex) as isize));
+    vec_b = _mm_load_ss(&*igtbl_b.offset(*src.add(F::kBIndex) as isize));
     if F::kAIndex != 0xff {
-        alpha = *src.offset(F::kAIndex as isize)
+        alpha = *src.add(F::kAIndex)
     }
     src = src.offset(components as isize);
     let mut i: libc::c_uint = 0;
     while (i as usize) < length {
         /* position values from gamma tables */
         vec_r = _mm_shuffle_ps(vec_r, vec_r, 0);
         vec_g = _mm_shuffle_ps(vec_g, vec_g, 0);
         vec_b = _mm_shuffle_ps(vec_b, vec_b, 0);
         /* gamma * matrix */
         vec_r = _mm_mul_ps(vec_r, mat0);
         vec_g = _mm_mul_ps(vec_g, mat1);
         vec_b = _mm_mul_ps(vec_b, mat2);
         /* store alpha for this pixel; load alpha for next */
         if F::kAIndex != 0xff {
-            *dest.offset(F::kAIndex as isize) = alpha;
-            alpha = *src.offset(F::kAIndex as isize)
+            *dest.add(F::kAIndex) = alpha;
+            alpha = *src.add(F::kAIndex)
         }
         /* crunch, crunch, crunch */
         vec_r = _mm_add_ps(vec_r, _mm_add_ps(vec_g, vec_b));
         vec_r = _mm_max_ps(min, vec_r);
         vec_r = _mm_min_ps(max, vec_r);
         result = _mm_mul_ps(vec_r, scale);
         /* store calc'd output tables indices */
         _mm_store_si128(output as *mut __m128i, _mm_cvtps_epi32(result));
         /* load gamma values for next loop while store completes */
-        vec_r = _mm_load_ss(&*igtbl_r.offset(*src.offset(F::kRIndex as isize) as isize));
-        vec_g = _mm_load_ss(&*igtbl_g.offset(*src.offset(F::kGIndex as isize) as isize));
-        vec_b = _mm_load_ss(&*igtbl_b.offset(*src.offset(F::kBIndex as isize) as isize));
+        vec_r = _mm_load_ss(&*igtbl_r.offset(*src.add(F::kRIndex) as isize));
+        vec_g = _mm_load_ss(&*igtbl_g.offset(*src.add(F::kGIndex) as isize));
+        vec_b = _mm_load_ss(&*igtbl_b.offset(*src.add(F::kBIndex) as isize));
         src = src.offset(components as isize);
         /* use calc'd indices to output RGB values */
-        *dest.offset(F::kRIndex as isize) = *otdata_r.offset(*output.offset(0isize) as isize);
-        *dest.offset(F::kGIndex as isize) = *otdata_g.offset(*output.offset(1isize) as isize);
-        *dest.offset(F::kBIndex as isize) = *otdata_b.offset(*output.offset(2isize) as isize);
+        *dest.add(F::kRIndex) = *otdata_r.offset(*output.offset(0isize) as isize);
+        *dest.add(F::kGIndex) = *otdata_g.offset(*output.offset(1isize) as isize);
+        *dest.add(F::kBIndex) = *otdata_b.offset(*output.offset(2isize) as isize);
         dest = dest.offset(components as isize);
-        i = i + 1
+        i += 1
     }
     /* handle final (maybe only) pixel */
     vec_r = _mm_shuffle_ps(vec_r, vec_r, 0);
     vec_g = _mm_shuffle_ps(vec_g, vec_g, 0);
     vec_b = _mm_shuffle_ps(vec_b, vec_b, 0);
     vec_r = _mm_mul_ps(vec_r, mat0);
     vec_g = _mm_mul_ps(vec_g, mat1);
     vec_b = _mm_mul_ps(vec_b, mat2);
     if F::kAIndex != 0xff {
-        *dest.offset(F::kAIndex as isize) = alpha
+        *dest.add(F::kAIndex) = alpha
     }
     vec_r = _mm_add_ps(vec_r, _mm_add_ps(vec_g, vec_b));
     vec_r = _mm_max_ps(min, vec_r);
     vec_r = _mm_min_ps(max, vec_r);
     result = _mm_mul_ps(vec_r, scale);
     _mm_store_si128(output as *mut __m128i, _mm_cvtps_epi32(result));
-    *dest.offset(F::kRIndex as isize) = *otdata_r.offset(*output.offset(0isize) as isize);
-    *dest.offset(F::kGIndex as isize) = *otdata_g.offset(*output.offset(1isize) as isize);
-    *dest.offset(F::kBIndex as isize) = *otdata_b.offset(*output.offset(2isize) as isize);
+    *dest.add(F::kRIndex) = *otdata_r.offset(*output.offset(0isize) as isize);
+    *dest.add(F::kGIndex) = *otdata_g.offset(*output.offset(1isize) as isize);
+    *dest.add(F::kBIndex) = *otdata_b.offset(*output.offset(2isize) as isize);
 }
 #[no_mangle]
 pub unsafe extern "C" fn qcms_transform_data_rgb_out_lut_sse2(
     mut transform: *const qcms_transform,
     mut src: *const libc::c_uchar,
     mut dest: *mut libc::c_uchar,
     mut length: usize,
 ) {
--- a/gfx/qcms/src/transform_util.rs
+++ b/gfx/qcms/src/transform_util.rs
@@ -30,68 +30,68 @@ use crate::{matrix::matrix, transform::P
 //XXX: could use a bettername
 pub type uint16_fract_t = u16;
 
 #[inline]
 fn u8Fixed8Number_to_float(mut x: u16) -> f32 {
     // 0x0000 = 0.
     // 0x0100 = 1.
     // 0xffff = 255  + 255/256
-    return (x as i32 as f64 / 256.0f64) as f32;
+    (x as i32 as f64 / 256.0f64) as f32
 }
 #[inline]
 pub fn clamp_float(mut a: f32) -> f32 {
     /* One would naturally write this function as the following:
     if (a > 1.)
       return 1.;
     else if (a < 0)
       return 0;
     else
       return a;
 
     However, that version will let NaNs pass through which is undesirable
     for most consumers.
     */
     if a > 1. {
-        return 1.;
+        1.
     } else if a >= 0. {
-        return a;
+        a
     } else {
         // a < 0 or a is NaN
-        return 0.;
+        0.
     }
 }
 /* value must be a value between 0 and 1 */
 //XXX: is the above a good restriction to have?
 // the output range of this functions is 0..1
 pub fn lut_interp_linear(mut input_value: f64, mut table: &[u16]) -> f32 {
-    input_value = input_value * (table.len() - 1) as f64;
+    input_value *= (table.len() - 1) as f64;
 
     let mut upper: i32 = input_value.ceil() as i32;
     let mut lower: i32 = input_value.floor() as i32;
     let mut value: f32 = ((table[upper as usize] as f64) * (1. - (upper as f64 - input_value))
         + (table[lower as usize] as f64 * (upper as f64 - input_value)))
         as f32;
     /* scale the value */
-    return value * (1.0 / 65535.0);
+    value * (1.0 / 65535.0)
 }
 /* same as above but takes and returns a uint16_t value representing a range from 0..1 */
 #[no_mangle]
 pub fn lut_interp_linear16(mut input_value: u16, mut table: &[u16]) -> u16 {
     /* Start scaling input_value to the length of the array: 65535*(length-1).
      * We'll divide out the 65535 next */
     let mut value: u32 = (input_value as i32 * (table.len() as i32 - 1)) as u32; /* equivalent to ceil(value/65535) */
     let mut upper: u32 = (value + 65534) / 65535; /* equivalent to floor(value/65535) */
     let mut lower: u32 = value / 65535;
     /* interp is the distance from upper to value scaled to 0..65535 */
     let mut interp: u32 = value % 65535; // 0..65535*65535
     value = (table[upper as usize] as u32 * interp
         + table[lower as usize] as u32 * (65535 - interp))
         / 65535;
-    return value as u16;
+    value as u16
 }
 /* same as above but takes an input_value from 0..PRECACHE_OUTPUT_MAX
  * and returns a uint8_t value representing a range from 0..1 */
 fn lut_interp_linear_precache_output(mut input_value: u32, mut table: &[u16]) -> u8 {
     /* Start scaling input_value to the length of the array: PRECACHE_OUTPUT_MAX*(length-1).
      * We'll divide out the PRECACHE_OUTPUT_MAX next */
     let mut value: u32 = input_value * (table.len() - 1) as libc::c_uint;
     /* equivalent to ceil(value/PRECACHE_OUTPUT_MAX) */
@@ -100,32 +100,32 @@ fn lut_interp_linear_precache_output(mut
     /* equivalent to floor(value/PRECACHE_OUTPUT_MAX) */
     let mut lower: u32 = value / PRECACHE_OUTPUT_MAX as libc::c_uint;
     /* interp is the distance from upper to value scaled to 0..PRECACHE_OUTPUT_MAX */
     let mut interp: u32 = value % PRECACHE_OUTPUT_MAX as libc::c_uint;
     /* the table values range from 0..65535 */
     value = table[upper as usize] as libc::c_uint * interp
         + table[lower as usize] as libc::c_uint * (PRECACHE_OUTPUT_MAX as libc::c_uint - interp); // 0..(65535*PRECACHE_OUTPUT_MAX)
                                                                                                   /* round and scale */
-    value = value + (PRECACHE_OUTPUT_MAX * 65535 / 255 / 2) as libc::c_uint; // scale to 0..255
-    value = value / (PRECACHE_OUTPUT_MAX * 65535 / 255) as libc::c_uint;
-    return value as u8;
+    value += (PRECACHE_OUTPUT_MAX * 65535 / 255 / 2) as libc::c_uint; // scale to 0..255
+    value /= (PRECACHE_OUTPUT_MAX * 65535 / 255) as libc::c_uint;
+    value as u8
 }
 /* value must be a value between 0 and 1 */
 //XXX: is the above a good restriction to have?
 pub fn lut_interp_linear_float(mut value: f32, mut table: &[f32]) -> f32 {
-    value = value * (table.len() - 1) as f32;
+    value *= (table.len() - 1) as f32;
 
     let mut upper: i32 = value.ceil() as i32;
     let mut lower: i32 = value.floor() as i32;
     //XXX: can we be more performant here?
     value = (table[upper as usize] as f64 * (1.0f64 - (upper as f32 - value) as f64)
         + (table[lower as usize] * (upper as f32 - value)) as f64) as f32;
     /* scale the value */
-    return value;
+    value
 }
 fn compute_curve_gamma_table_type1(mut gamma_table: &mut Vec<f32>, mut gamma: u16) {
     let mut gamma_float: f32 = u8Fixed8Number_to_float(gamma);
     for i in 0..256 {
         // 0..1^(0..255 + 255/256) will always be between 0 and 1
         gamma_table.push((i as f64 / 255.0f64).powf(gamma_float as f64) as f32);
     }
 }
@@ -221,34 +221,34 @@ pub(crate) fn build_input_gamma_table(mu
         }
         curveType::Curve(data) => match data.len() {
             0 => compute_curve_gamma_table_type0(&mut gamma_table),
             1 => compute_curve_gamma_table_type1(&mut gamma_table, data[0]),
             _ => compute_curve_gamma_table_type2(&mut gamma_table, data),
         },
     }
 
-    return Some(gamma_table);
+    Some(gamma_table)
 }
 pub fn build_colorant_matrix(mut p: &qcms_profile) -> matrix {
     let mut result: matrix = matrix {
         m: [[0.; 3]; 3],
         invalid: false,
     };
     result.m[0][0] = s15Fixed16Number_to_float(p.redColorant.X);
     result.m[0][1] = s15Fixed16Number_to_float(p.greenColorant.X);
     result.m[0][2] = s15Fixed16Number_to_float(p.blueColorant.X);
     result.m[1][0] = s15Fixed16Number_to_float(p.redColorant.Y);
     result.m[1][1] = s15Fixed16Number_to_float(p.greenColorant.Y);
     result.m[1][2] = s15Fixed16Number_to_float(p.blueColorant.Y);
     result.m[2][0] = s15Fixed16Number_to_float(p.redColorant.Z);
     result.m[2][1] = s15Fixed16Number_to_float(p.greenColorant.Z);
     result.m[2][2] = s15Fixed16Number_to_float(p.blueColorant.Z);
     result.invalid = false;
-    return result;
+    result
 }
 /* The following code is copied nearly directly from lcms.
  * I think it could be much better. For example, Argyll seems to have better code in
  * icmTable_lookup_bwd and icmTable_setup_bwd. However, for now this is a quick way
  * to a working solution and allows for easy comparing with lcms. */
 #[no_mangle]
 pub fn lut_inverse_interp16(mut Value: u16, mut LutTable: &[u16]) -> uint16_fract_t {
     let mut l: i32 = 1; // 'int' Give spacing for negative values
@@ -332,17 +332,17 @@ pub fn lut_inverse_interp16(mut Value: u
     }
     let mut f: f64 = (Value as i32 as f64 - b) / a;
     if f < 0.0f64 {
         return 0u16;
     }
     if f >= 65535.0f64 {
         return 0xffffu16;
     }
-    return (f + 0.5f64).floor() as uint16_fract_t;
+    (f + 0.5f64).floor() as uint16_fract_t
 }
 /*
 The number of entries needed to invert a lookup table should not
 necessarily be the same as the original number of entries.  This is
 especially true of lookup tables that have a small number of entries.
 
 For example:
 Using a table like:
@@ -356,57 +356,57 @@ fn invert_lut(mut table: &[u16], mut out
     /* for now we invert the lut by creating a lut of size out_length
      * and attempting to lookup a value for each entry using lut_inverse_interp16 */
     let mut output = Vec::with_capacity(out_length as usize);
     for i in 0..out_length {
         let mut x: f64 = i as f64 * 65535.0f64 / (out_length - 1) as f64;
         let mut input: uint16_fract_t = (x + 0.5f64).floor() as uint16_fract_t;
         output.push(lut_inverse_interp16(input, table));
     }
-    return output;
+    output
 }
 fn compute_precache_pow(output: &mut [u8; PRECACHE_OUTPUT_SIZE], mut gamma: f32) {
     let mut v: u32 = 0;
     while v < PRECACHE_OUTPUT_SIZE as u32 {
         //XXX: don't do integer/float conversion... and round?
         output[v as usize] =
             (255.0f64 * (v as f64 / PRECACHE_OUTPUT_MAX as f64).powf(gamma as f64)) as u8;
-        v = v + 1
+        v += 1
     }
 }
 pub fn compute_precache_lut(mut output: &mut [u8; PRECACHE_OUTPUT_SIZE], mut table: &[u16]) {
     let mut v: u32 = 0;
     while v < PRECACHE_OUTPUT_SIZE as u32 {
         output[v as usize] = lut_interp_linear_precache_output(v, table);
-        v = v + 1
+        v += 1
     }
 }
 pub fn compute_precache_linear(mut output: &mut [u8; PRECACHE_OUTPUT_SIZE]) {
     let mut v: u32 = 0;
     while v < PRECACHE_OUTPUT_SIZE as u32 {
         //XXX: round?
         output[v as usize] = (v / (PRECACHE_OUTPUT_SIZE / 256) as libc::c_uint) as u8;
-        v = v + 1
+        v += 1
     }
 }
 pub(crate) fn compute_precache(
     mut trc: &curveType,
     mut output: &mut [u8; PRECACHE_OUTPUT_SIZE],
 ) -> bool {
     match trc {
         curveType::Parametric(params) => {
             let mut gamma_table = Vec::with_capacity(256);
             let mut gamma_table_uint: [u16; 256] = [0; 256];
 
             let mut inverted_size: i32 = 256;
             compute_curve_gamma_table_type_parametric(&mut gamma_table, params);
             let mut i: u16 = 0u16;
             while (i as i32) < 256 {
                 gamma_table_uint[i as usize] = (gamma_table[i as usize] * 65535f32) as u16;
-                i = i + 1
+                i += 1
             }
             //XXX: the choice of a minimum of 256 here is not backed by any theory,
             //     measurement or data, howeve r it is what lcms uses.
             //     the maximum number we would need is 65535 because that's the
             //     accuracy used for computing the pre cache table
             if inverted_size < 256 {
                 inverted_size = 256
             }
@@ -427,61 +427,61 @@ pub(crate) fn compute_precache(
                         inverted_size = 256
                     } //XXX turn this conversion into a function
                     let mut inverted = invert_lut(data, inverted_size);
                     compute_precache_lut(output, &inverted);
                 }
             }
         }
     }
-    return true;
+    true
 }
 fn build_linear_table(mut length: i32) -> Vec<u16> {
     let mut output = Vec::with_capacity(length as usize);
     for i in 0..length {
         let mut x: f64 = i as f64 * 65535.0f64 / (length - 1) as f64;
         let mut input: uint16_fract_t = (x + 0.5f64).floor() as uint16_fract_t;
         output.push(input);
     }
-    return output;
+    output
 }
 fn build_pow_table(mut gamma: f32, mut length: i32) -> Vec<u16> {
     let mut output = Vec::with_capacity(length as usize);
     for i in 0..length {
         let mut x: f64 = i as f64 / (length - 1) as f64;
         x = x.powf(gamma as f64);
         let mut result: uint16_fract_t = (x * 65535.0f64 + 0.5f64).floor() as uint16_fract_t;
         output.push(result);
     }
-    return output;
+    output
 }
 
 pub(crate) fn build_output_lut(mut trc: &curveType) -> Vec<u16> {
     match trc {
         curveType::Parametric(params) => {
             let mut gamma_table = Vec::with_capacity(256);
             let mut output = Vec::with_capacity(256);
             compute_curve_gamma_table_type_parametric(&mut gamma_table, params);
             for i in 0..256 {
                 output.push((gamma_table[i as usize] * 65535f32) as u16);
             }
-            return output;
+            output
         }
         curveType::Curve(data) => {
-            return match data.len() {
+            match data.len() {
                 0 => build_linear_table(4096),
                 1 => {
                     let mut gamma = 1. / u8Fixed8Number_to_float(data[0]);
                     build_pow_table(gamma, 4096)
                 }
                 _ => {
                     //XXX: the choice of a minimum of 256 here is not backed by any theory,
                     //     measurement or data, however it is what lcms uses.
                     let mut output_gamma_lut_length = data.len();
                     if output_gamma_lut_length < 256 {
                         output_gamma_lut_length = 256
                     }
                     invert_lut(data, output_gamma_lut_length as i32)
                 }
-            };
+            }
         }
     }
 }