mirror of
https://github.com/eyre-rs/eyre.git
synced 2025-09-27 13:01:29 +00:00
fix: warnings from new clippy lints
This commit is contained in:
parent
2b32acdd03
commit
90645efddc
@ -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>();
|
||||
@ -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)) }
|
||||
@ -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)) }
|
||||
|
@ -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();
|
||||
@ -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();
|
||||
|
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user