linter updates

Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
2021-11-12 15:48:17 +01:00
parent c1a4547261
commit c8f6a6d272
36 changed files with 1005 additions and 614 deletions

View File

@@ -1,4 +1,5 @@
#[cfg(windows)] extern crate winapi;
#[cfg(windows)]
extern crate winapi;
use std::io::Error;
#[cfg(windows)]
@@ -7,13 +8,14 @@ fn print_message(msg: &str) -> Result<i32, Error> {
use std::iter::once;
use std::os::windows::ffi::OsStrExt;
use std::ptr::null_mut;
use winapi::um::winuser::{MB_OK, MessageBoxW};
use winapi::um::winuser::{MessageBoxW, MB_OK};
let wide: Vec<u16> = OsStr::new(msg).encode_wide().chain(once(0)).collect();
let ret = unsafe {
MessageBoxW(null_mut(), wide.as_ptr(), wide.as_ptr(), MB_OK)
};
if ret == 0 { Err(Error::last_os_error()) }
else { Ok(ret) }
let ret = unsafe { MessageBoxW(null_mut(), wide.as_ptr(), wide.as_ptr(), MB_OK) };
if ret == 0 {
Err(Error::last_os_error())
} else {
Ok(ret)
}
}
#[cfg(not(windows))]