Use is
method instead of downcast_ref::<T>().is_some()
in App::is_plugin_added
(#11949)
# Objective Improve code quality and performance ## Solution Instead of using `plugin.downcast_ref::<T>().is_some()` in `App::is_plugin_added`, use `plugin.is::<T>()`. Which is more performant and cleaner.
This commit is contained in:
parent
c3db02e36e
commit
a1ef7be4ac
@ -671,9 +671,7 @@ impl App {
|
|||||||
where
|
where
|
||||||
T: Plugin,
|
T: Plugin,
|
||||||
{
|
{
|
||||||
self.plugin_registry
|
self.plugin_registry.iter().any(|p| p.is::<T>())
|
||||||
.iter()
|
|
||||||
.any(|p| p.downcast_ref::<T>().is_some())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a vector of references to any plugins of type `T` that have been added.
|
/// Returns a vector of references to any plugins of type `T` that have been added.
|
||||||
|
Loading…
Reference in New Issue
Block a user