mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
Fix clippy for Rust 1.69 (#3246)
* Fix clippy for Rust 1.69. * use std::marker::PhantonData. * Change callee to caller.
This commit is contained in:
parent
d0205a8ea3
commit
dbe671e8c4
@ -69,11 +69,20 @@ mod feat_ssr_hydration {
|
||||
}
|
||||
|
||||
impl Collectable {
|
||||
#[cfg(not(debug_assertions))]
|
||||
#[inline(always)]
|
||||
pub fn for_component<T: 'static>() -> Self {
|
||||
use std::marker::PhantomData;
|
||||
// This suppresses the clippy lint about unused generic.
|
||||
// We inline this function
|
||||
// so the function body is copied to its caller and generics get optimised away.
|
||||
let _comp_type: PhantomData<T> = PhantomData;
|
||||
Self::Component(PhantomData)
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
pub fn for_component<T: 'static>() -> Self {
|
||||
#[cfg(debug_assertions)]
|
||||
let comp_name = std::any::type_name::<T>();
|
||||
#[cfg(not(debug_assertions))]
|
||||
let comp_name = std::marker::PhantomData;
|
||||
Self::Component(comp_name)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user