diff options
author | Bilal Elmoussaoui <belmouss@redhat.com> | 2023-02-08 20:05:50 +0100 |
---|---|---|
committer | Bilal Elmoussaoui <belmouss@redhat.com> | 2023-02-08 20:05:50 +0100 |
commit | 42854b17d4024b0ff36617745af950fe88d9f57b (patch) | |
tree | eebaba014c073bd0ba877f10c39c7d6bc56399b4 | |
parent | 9ccc49489664ac56caf6d3f8a01953926c06cea1 (diff) | |
download | librsvg-42854b17d4024b0ff36617745af950fe88d9f57b.tar.gz |
gdk-pixbuf-loader: Use is_null directly
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/792>
-rw-r--r-- | gdk-pixbuf-loader/src/lib.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gdk-pixbuf-loader/src/lib.rs b/gdk-pixbuf-loader/src/lib.rs index 63fc6a46..53e96e18 100644 --- a/gdk-pixbuf-loader/src/lib.rs +++ b/gdk-pixbuf-loader/src/lib.rs @@ -202,7 +202,7 @@ mod tests { use crate::{EXTENSIONS, MIME_TYPES}; use libc::c_char; - use std::ptr::{null, null_mut}; + use std::ptr::null_mut; fn pb_format_new() -> GdkPixbufFormat { let mut info = super::GdkPixbufFormat { @@ -240,9 +240,9 @@ mod tests { fn check_null_terminated_arr_cstrings(arr: &[*const c_char]) { let n_strings = arr .iter() - .filter(|e| e != &&null()) + .filter(|e| !e.is_null()) .map(|e| { - if e != &null() { + if !e.is_null() { // We use strlen in all of them to ensure some safety // We could use CStr instead but it'd be a bit more cumbersome assert!(unsafe { libc::strlen(*e as *const c_char) } > 0) @@ -252,7 +252,7 @@ mod tests { // Ensure last item is null and is the only null item assert_eq!(n_strings, arr.len() - 1); - assert!(arr.last().unwrap() == &null()); + assert!(arr.last().unwrap().is_null()); } #[test] @@ -272,10 +272,10 @@ mod tests { for i in 0..2 { let ptr = info.signature.offset(i); if i == 2 { - assert_eq!((*ptr).prefix, null_mut()); + assert!((*ptr).prefix.is_null()); continue; } else { - assert_ne!((*ptr).prefix, null_mut()); + assert!(!(*ptr).prefix.is_null()); if (*ptr).mask != null_mut() { // Mask can be null assert_eq!( |