Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerthox committed Jan 20, 2025
1 parent d4d3212 commit 915ff30
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,3 @@ serde = ["dep:serde", "arcdps/serde"]
settings = ["serde", "serde_json"]
update = ["minreq", "open", "semver", "dep:serde"]
log = ["chrono"]

# [patch."https://github.com/zerthox/arcdps-rs"]
# arcdps = { path = "../arcdps-rs/arcdps" }
7 changes: 3 additions & 4 deletions src/tracking/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,9 @@ impl<T> CachedTracker<T> {
where
T: Clone,
{
self.tracker.remove_player(id).map(|entry| {
self.maybe_cache(entry.clone());
entry
})
self.tracker
.remove_player(id)
.inspect(|entry| self.maybe_cache(entry.clone()))
}

/// Returns a reference to the local player (self).
Expand Down
6 changes: 2 additions & 4 deletions src/ui/render/table.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use arcdps::imgui::{Id, TableColumnFlags, TableColumnSetup, TableFlags, TableToken, Ui};
use std::{ffi::c_void, mem};
use windows::Win32::Graphics::Direct3D11::ID3D11ShaderResourceView;
use windows::{core::Interface, Win32::Graphics::Direct3D11::ID3D11ShaderResourceView};

/// Renders a table with (optional) icon headers.
pub fn table_with_icons<'ui, N>(
Expand Down Expand Up @@ -127,8 +126,7 @@ pub fn table_header_icon(ui: &Ui, label: impl AsRef<str>, icon: Option<&Icon>) {
ui.set_cursor_screen_pos([pos_x + size, pos_y]);
ui.table_header(format!("##{label}"));

// avoid dropping by transmuting the reference
let ptr = *unsafe { mem::transmute::<_, &*const c_void>(icon) };
let ptr = icon.as_raw();
ui.get_window_draw_list()
.add_image(ptr.into(), [pos_x, top], [pos_x + size, top + size])
.build();
Expand Down

0 comments on commit 915ff30

Please sign in to comment.