Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Zerthox committed Dec 21, 2024
1 parent 2d3743a commit 609e12c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions reffect/src/context/edit_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,13 @@ impl EditState {
self.allowed = false;
}

// do not expose these references!
unsafe fn get_clipboard(&self) -> &Option<Element> {
self.clipboard.get().as_ref().unwrap_unchecked()
}

// do not expose these references!
#[allow(clippy::mut_from_ref)]
unsafe fn get_clipboard_mut(&self) -> &mut Option<Element> {
self.clipboard.get().as_mut().unwrap_unchecked()
}
Expand Down
6 changes: 3 additions & 3 deletions reffect/src/render_util/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ impl From<Option<String>> for LoadedFont {
}
}

impl Into<Option<String>> for LoadedFont {
fn into(self) -> Option<String> {
self.name
impl From<LoadedFont> for Option<String> {
fn from(font: LoadedFont) -> Self {
font.name
}
}
4 changes: 2 additions & 2 deletions reffect/src/trigger/progress/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ impl ProgressSource {
buffs
.get(&id)
.filter(|buff| buff.runout_time > ctx.now)
.map(|buff| ProgressActive::from_buff(id, &buff))
.map(|buff| ProgressActive::from_buff(id, buff))
.unwrap_or_else(|| ProgressActive::empy_timed(id))
}),
Self::AnyBuff(ref ids) => ctx.own_buffs().map(|buffs| {
let mut combined = Buff::empty();
for id in ids {
if let Some(buff) = buffs.get(&id).filter(|buff| buff.runout_time > ctx.now) {
if let Some(buff) = buffs.get(id).filter(|buff| buff.runout_time > ctx.now) {
combined.stacks += buff.stacks;
combined.apply_time = combined.apply_time.max(buff.apply_time);
combined.runout_time = combined.runout_time.max(buff.runout_time);
Expand Down

0 comments on commit 609e12c

Please sign in to comment.