summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilal Elmoussaoui <belmouss@redhat.com>2023-02-08 20:05:50 +0100
committerBilal Elmoussaoui <belmouss@redhat.com>2023-02-08 20:05:50 +0100
commit42854b17d4024b0ff36617745af950fe88d9f57b (patch)
treeeebaba014c073bd0ba877f10c39c7d6bc56399b4
parent9ccc49489664ac56caf6d3f8a01953926c06cea1 (diff)
downloadlibrsvg-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.rs12
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!(