Skip to content

Commit

Permalink
format project
Browse files Browse the repository at this point in the history
  • Loading branch information
ezekiel committed Jul 13, 2023
1 parent 0c53e09 commit 19f02c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/detour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl DownloadState {
lua: state,
handles: Vec::new(),
timestamp: None,
}
};
}
}

Expand All @@ -52,7 +52,7 @@ unsafe extern "cdecl" fn GetDownloadQueueSize_detour() -> i64 {
let state = &mut binding.lock().unwrap();
let res: i64 = GET_DOWNLOAD_QUEUE_SIZE_DETOUR.as_ref().unwrap().call();

return res + <usize as TryInto<i64>>::try_into(state.handles.len()).unwrap()
return res + <usize as TryInto<i64>>::try_into(state.handles.len()).unwrap();
}

#[type_alias(QueueDownload)]
Expand Down Expand Up @@ -126,7 +126,7 @@ unsafe extern "cdecl" fn QueueDownload_detour(
return Ok(path.to_str().unwrap().to_string());
}

return Err(AcceleratorError::RemoteFileNotFound(path.display().to_string(), url).into())
return Err(AcceleratorError::RemoteFileNotFound(path.display().to_string(), url).into());
});
state.handles.push(handle);
}
Expand Down Expand Up @@ -154,7 +154,7 @@ unsafe extern "cdecl" fn DownloadUpdate_detour() -> bool {
}
}

return DOWNLOAD_UPDATE_DETOUR.as_ref().unwrap().call()
return DOWNLOAD_UPDATE_DETOUR.as_ref().unwrap().call();
}

pub unsafe fn apply(l: LuaState) -> Result<()> {
Expand Down Expand Up @@ -220,7 +220,7 @@ pub unsafe fn apply(l: LuaState) -> Result<()> {

STATE = Some(Mutex::new(state));

return Ok(())
return Ok(());
}

pub unsafe fn revert(l: LuaState) {
Expand Down
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ macro_rules! log {
fn open(l: LuaState) -> Result<i32> {
log!(l, "loading...");

unsafe { detour::apply(l)?; }
unsafe {
detour::apply(l)?;
}

Ok(0)
}
Expand All @@ -32,7 +34,9 @@ fn open(l: LuaState) -> Result<i32> {
fn close(l: LuaState) -> Result<i32> {
log!(l, "unloading...");

unsafe { detour::revert(l); }
unsafe {
detour::revert(l);
}

Ok(0)
}

0 comments on commit 19f02c0

Please sign in to comment.