Skip to content

Commit

Permalink
fix: warnings from new clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
ten3roberts committed Mar 29, 2024
1 parent 2b32acd commit 90645ef
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
6 changes: 3 additions & 3 deletions eyre/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ fn capture_handler(error: &(dyn StdError + 'static)) -> Box<dyn EyreHandler> {
}

impl dyn EyreHandler {
///
/// Check if the handler is of type `T`
pub fn is<T: EyreHandler>(&self) -> bool {
// Get `TypeId` of the type this function is instantiated with.
let t = core::any::TypeId::of::<T>();
Expand All @@ -636,7 +636,7 @@ impl dyn EyreHandler {
t == concrete
}

///
/// Downcast the handler to a contcrete type `T`
pub fn downcast_ref<T: EyreHandler>(&self) -> Option<&T> {
if self.is::<T>() {
unsafe { Some(&*(self as *const dyn EyreHandler as *const T)) }
Expand All @@ -645,7 +645,7 @@ impl dyn EyreHandler {
}
}

///
/// Downcast the handler to a contcrete type `T`
pub fn downcast_mut<T: EyreHandler>(&mut self) -> Option<&mut T> {
if self.is::<T>() {
unsafe { Some(&mut *(self as *mut dyn EyreHandler as *mut T)) }
Expand Down
2 changes: 0 additions & 2 deletions eyre/tests/test_location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ fn test_context() {
Box::new(LocationHandler::new(expected_location))
}));

use eyre::WrapErr;
let err = read_path("totally_fake_path")
.context("oopsie")
.unwrap_err();
Expand All @@ -126,7 +125,6 @@ fn test_with_context() {
Box::new(LocationHandler::new(expected_location))
}));

use eyre::WrapErr;
let err = read_path("totally_fake_path")
.with_context(|| "oopsie")
.unwrap_err();
Expand Down
1 change: 0 additions & 1 deletion eyre/tests/test_repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ mod drop;
use self::common::maybe_install_handler;
use self::drop::{DetectDrop, Flag};
use eyre::Report;
use std::marker::Unpin;
use std::mem;

#[test]
Expand Down

0 comments on commit 90645ef

Please sign in to comment.