fix: fix Rust v1.78.0 clippy warnings

This commit is contained in:
Boshen 2024-06-12 10:49:36 +08:00
parent 813232ba79
commit 375143f8f6
No known key found for this signature in database
GPG Key ID: 9C7A8C8AB22BEBD1
2 changed files with 5 additions and 5 deletions

View File

@ -410,7 +410,7 @@ impl Report {
} }
/// Provide source code for this error /// Provide source code for this error
pub fn with_source_code(self, source_code: impl SourceCode + Send + Sync + 'static) -> Report { pub fn with_source_code(self, source_code: impl SourceCode + 'static) -> Report {
WithSourceCode { WithSourceCode {
source_code, source_code,
error: self, error: self,

View File

@ -57,7 +57,7 @@ pub struct Report {
unsafe impl Sync for Report {} unsafe impl Sync for Report {}
unsafe impl Send for Report {} unsafe impl Send for Report {}
/// #[allow(missing_docs)]
pub type ErrorHook = pub type ErrorHook =
Box<dyn Fn(&(dyn Diagnostic + 'static)) -> Box<dyn ReportHandler> + Sync + Send + 'static>; Box<dyn Fn(&(dyn Diagnostic + 'static)) -> Box<dyn ReportHandler> + Sync + Send + 'static>;
@ -109,7 +109,7 @@ fn get_default_printer(_err: &(dyn Diagnostic + 'static)) -> Box<dyn ReportHandl
} }
impl dyn ReportHandler { impl dyn ReportHandler {
/// #[allow(missing_docs)]
pub fn is<T: ReportHandler>(&self) -> bool { pub fn is<T: ReportHandler>(&self) -> bool {
// Get `TypeId` of the type this function is instantiated with. // Get `TypeId` of the type this function is instantiated with.
let t = core::any::TypeId::of::<T>(); let t = core::any::TypeId::of::<T>();
@ -121,7 +121,7 @@ impl dyn ReportHandler {
t == concrete t == concrete
} }
/// #[allow(missing_docs)]
pub fn downcast_ref<T: ReportHandler>(&self) -> Option<&T> { pub fn downcast_ref<T: ReportHandler>(&self) -> Option<&T> {
if self.is::<T>() { if self.is::<T>() {
unsafe { Some(&*(self as *const dyn ReportHandler as *const T)) } unsafe { Some(&*(self as *const dyn ReportHandler as *const T)) }
@ -130,7 +130,7 @@ impl dyn ReportHandler {
} }
} }
/// #[allow(missing_docs)]
pub fn downcast_mut<T: ReportHandler>(&mut self) -> Option<&mut T> { pub fn downcast_mut<T: ReportHandler>(&mut self) -> Option<&mut T> {
if self.is::<T>() { if self.is::<T>() {
unsafe { Some(&mut *(self as *mut dyn ReportHandler as *mut T)) } unsafe { Some(&mut *(self as *mut dyn ReportHandler as *mut T)) }