Nightly clippy fixes (#2702)
A few minor changes to fix warnings emitted from clippy on the nightly toolchain, including redundant_allocation, unwrap_or_else_default, and collapsible_match, fixes #2698
This commit is contained in:
parent
cbe9e56d85
commit
4c3c4b5e40
@ -53,7 +53,7 @@ pub struct AssetServerInternal {
|
|||||||
pub(crate) asset_ref_counter: AssetRefCounter,
|
pub(crate) asset_ref_counter: AssetRefCounter,
|
||||||
pub(crate) asset_sources: Arc<RwLock<HashMap<SourcePathId, SourceInfo>>>,
|
pub(crate) asset_sources: Arc<RwLock<HashMap<SourcePathId, SourceInfo>>>,
|
||||||
pub(crate) asset_lifecycles: Arc<RwLock<HashMap<Uuid, Box<dyn AssetLifecycle>>>>,
|
pub(crate) asset_lifecycles: Arc<RwLock<HashMap<Uuid, Box<dyn AssetLifecycle>>>>,
|
||||||
loaders: RwLock<Vec<Arc<Box<dyn AssetLoader>>>>,
|
loaders: RwLock<Vec<Arc<dyn AssetLoader>>>,
|
||||||
extension_to_loader_index: RwLock<HashMap<String, usize>>,
|
extension_to_loader_index: RwLock<HashMap<String, usize>>,
|
||||||
handle_to_path: Arc<RwLock<HashMap<HandleId, AssetPath<'static>>>>,
|
handle_to_path: Arc<RwLock<HashMap<HandleId, AssetPath<'static>>>>,
|
||||||
task_pool: TaskPool,
|
task_pool: TaskPool,
|
||||||
@ -112,7 +112,7 @@ impl AssetServer {
|
|||||||
.write()
|
.write()
|
||||||
.insert(extension.to_string(), loader_index);
|
.insert(extension.to_string(), loader_index);
|
||||||
}
|
}
|
||||||
loaders.push(Arc::new(Box::new(loader)));
|
loaders.push(Arc::new(loader));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn watch_for_changes(&self) -> Result<(), AssetServerError> {
|
pub fn watch_for_changes(&self) -> Result<(), AssetServerError> {
|
||||||
@ -130,10 +130,7 @@ impl AssetServer {
|
|||||||
HandleUntyped::strong(id.into(), sender)
|
HandleUntyped::strong(id.into(), sender)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_asset_loader(
|
fn get_asset_loader(&self, extension: &str) -> Result<Arc<dyn AssetLoader>, AssetServerError> {
|
||||||
&self,
|
|
||||||
extension: &str,
|
|
||||||
) -> Result<Arc<Box<dyn AssetLoader>>, AssetServerError> {
|
|
||||||
let index = {
|
let index = {
|
||||||
// scope map to drop lock as soon as possible
|
// scope map to drop lock as soon as possible
|
||||||
let map = self.server.extension_to_loader_index.read();
|
let map = self.server.extension_to_loader_index.read();
|
||||||
@ -149,7 +146,7 @@ impl AssetServer {
|
|||||||
fn get_path_asset_loader<P: AsRef<Path>>(
|
fn get_path_asset_loader<P: AsRef<Path>>(
|
||||||
&self,
|
&self,
|
||||||
path: P,
|
path: P,
|
||||||
) -> Result<Arc<Box<dyn AssetLoader>>, AssetServerError> {
|
) -> Result<Arc<dyn AssetLoader>, AssetServerError> {
|
||||||
let s = path
|
let s = path
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.file_name()
|
.file_name()
|
||||||
|
|||||||
@ -43,7 +43,7 @@ impl Plugin for CorePlugin {
|
|||||||
app.world
|
app.world
|
||||||
.get_resource::<DefaultTaskPoolOptions>()
|
.get_resource::<DefaultTaskPoolOptions>()
|
||||||
.cloned()
|
.cloned()
|
||||||
.unwrap_or_else(DefaultTaskPoolOptions::default)
|
.unwrap_or_default()
|
||||||
.create_default_pools(&mut app.world);
|
.create_default_pools(&mut app.world);
|
||||||
|
|
||||||
app.init_resource::<Time>()
|
app.init_resource::<Time>()
|
||||||
|
|||||||
@ -557,9 +557,7 @@ pub fn impl_reflect_value(input: TokenStream) -> TokenStream {
|
|||||||
|
|
||||||
let bevy_reflect_path = BevyManifest::default().get_path("bevy_reflect");
|
let bevy_reflect_path = BevyManifest::default().get_path("bevy_reflect");
|
||||||
let ty = &reflect_value_def.type_name;
|
let ty = &reflect_value_def.type_name;
|
||||||
let reflect_attrs = reflect_value_def
|
let reflect_attrs = reflect_value_def.attrs.unwrap_or_default();
|
||||||
.attrs
|
|
||||||
.unwrap_or_else(ReflectAttrs::default);
|
|
||||||
let registration_data = &reflect_attrs.data;
|
let registration_data = &reflect_attrs.data;
|
||||||
let get_type_registration_impl = impl_get_type_registration(
|
let get_type_registration_impl = impl_get_type_registration(
|
||||||
ty,
|
ty,
|
||||||
|
|||||||
@ -112,7 +112,7 @@ pub fn get_wgpu_render_system(world: &mut World) -> impl FnMut(&mut World) {
|
|||||||
let options = world
|
let options = world
|
||||||
.get_resource::<WgpuOptions>()
|
.get_resource::<WgpuOptions>()
|
||||||
.cloned()
|
.cloned()
|
||||||
.unwrap_or_else(WgpuOptions::default);
|
.unwrap_or_default();
|
||||||
let mut wgpu_renderer = future::block_on(WgpuRenderer::new(options));
|
let mut wgpu_renderer = future::block_on(WgpuRenderer::new(options));
|
||||||
|
|
||||||
let resource_context = WgpuRenderResourceContext::new(wgpu_renderer.device.clone());
|
let resource_context = WgpuRenderResourceContext::new(wgpu_renderer.device.clone());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user