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:
Doonv 2024-02-19 00:17:17 +02:00 committed by GitHub
parent c3db02e36e
commit a1ef7be4ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -671,9 +671,7 @@ impl App {
where
T: Plugin,
{
self.plugin_registry
.iter()
.any(|p| p.downcast_ref::<T>().is_some())
self.plugin_registry.iter().any(|p| p.is::<T>())
}
/// Returns a vector of references to any plugins of type `T` that have been added.