diff --git a/src/windows.rs b/src/windows.rs index a5e56a8..1acbc94 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -1,12 +1,10 @@ //! A small windows application to inject the Rivets DLL into Factorio. use crate::common; -use anyhow::{anyhow, bail, Context, Result}; +use anyhow::{anyhow, bail, Result}; use dll_syringe::process::{BorrowedProcess, ProcessModule}; use dll_syringe::{process::OwnedProcess, Syringe}; use std::ffi::CString; -use std::fs; -use std::fs::File; use std::io; use std::os::windows::io::FromRawHandle; use std::path::{Path, PathBuf}; @@ -50,7 +48,7 @@ fn rpc( let rpc = unsafe { syringe.get_payload_procedure:: Option>(module, "main") }? - .ok_or(anyhow!("Failed to get RPC procedure"))?; + .ok_or_else(|| anyhow!("Failed to get RPC procedure"))?; match rpc.call( &read_path.as_ref().to_path_buf(), &write_path.as_ref().to_path_buf(), @@ -60,6 +58,7 @@ fn rpc( } } +#[allow(clippy::cast_possible_truncation)] fn create_pipe() -> Result<(HANDLE, HANDLE)> { let mut stdout_read = INVALID_HANDLE_VALUE; let mut stdout_write = INVALID_HANDLE_VALUE;