Browse Source

Use more idiomatic 'if let'

master
Alex Williams 2 months ago
parent
commit
c1b4e5dae4
Signed by: aw GPG Key ID: 19EE4AAA361A7E2C
1 changed files with 1 additions and 4 deletions
  1. +1
    -4
      src/lib.rs

+ 1
- 4
src/lib.rs View File

@@ -25,10 +25,7 @@ pub extern "C" fn extract(c_struct: *mut PilStruct) -> i32 {
string: "pilrust\x00".as_ptr(),
array: [80, 105, 99, 111, 76, 105, 115, 112],
};
match c_struct.is_null() {
true => return -1,
_ => {},
}
if let true = c_struct.is_null() { return -1 };
unsafe {
let r_struct = &*c_struct;
println!("Received struct: {:#?}", &r_struct);


Loading…
Cancel
Save