mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
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
4 changed files with 7 additions and 12 deletions
|
@ -53,7 +53,7 @@ pub struct AssetServerInternal {
|
|||
pub(crate) asset_ref_counter: AssetRefCounter,
|
||||
pub(crate) asset_sources: Arc<RwLock<HashMap<SourcePathId, SourceInfo>>>,
|
||||
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>>,
|
||||
handle_to_path: Arc<RwLock<HashMap<HandleId, AssetPath<'static>>>>,
|
||||
task_pool: TaskPool,
|
||||
|
@ -112,7 +112,7 @@ impl AssetServer {
|
|||
.write()
|
||||
.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> {
|
||||
|
@ -130,10 +130,7 @@ impl AssetServer {
|
|||
HandleUntyped::strong(id.into(), sender)
|
||||
}
|
||||
|
||||
fn get_asset_loader(
|
||||
&self,
|
||||
extension: &str,
|
||||
) -> Result<Arc<Box<dyn AssetLoader>>, AssetServerError> {
|
||||
fn get_asset_loader(&self, extension: &str) -> Result<Arc<dyn AssetLoader>, AssetServerError> {
|
||||
let index = {
|
||||
// scope map to drop lock as soon as possible
|
||||
let map = self.server.extension_to_loader_index.read();
|
||||
|
@ -149,7 +146,7 @@ impl AssetServer {
|
|||
fn get_path_asset_loader<P: AsRef<Path>>(
|
||||
&self,
|
||||
path: P,
|
||||
) -> Result<Arc<Box<dyn AssetLoader>>, AssetServerError> {
|
||||
) -> Result<Arc<dyn AssetLoader>, AssetServerError> {
|
||||
let s = path
|
||||
.as_ref()
|
||||
.file_name()
|
||||
|
|
|
@ -43,7 +43,7 @@ impl Plugin for CorePlugin {
|
|||
app.world
|
||||
.get_resource::<DefaultTaskPoolOptions>()
|
||||
.cloned()
|
||||
.unwrap_or_else(DefaultTaskPoolOptions::default)
|
||||
.unwrap_or_default()
|
||||
.create_default_pools(&mut app.world);
|
||||
|
||||
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 ty = &reflect_value_def.type_name;
|
||||
let reflect_attrs = reflect_value_def
|
||||
.attrs
|
||||
.unwrap_or_else(ReflectAttrs::default);
|
||||
let reflect_attrs = reflect_value_def.attrs.unwrap_or_default();
|
||||
let registration_data = &reflect_attrs.data;
|
||||
let get_type_registration_impl = impl_get_type_registration(
|
||||
ty,
|
||||
|
|
|
@ -112,7 +112,7 @@ pub fn get_wgpu_render_system(world: &mut World) -> impl FnMut(&mut World) {
|
|||
let options = world
|
||||
.get_resource::<WgpuOptions>()
|
||||
.cloned()
|
||||
.unwrap_or_else(WgpuOptions::default);
|
||||
.unwrap_or_default();
|
||||
let mut wgpu_renderer = future::block_on(WgpuRenderer::new(options));
|
||||
|
||||
let resource_context = WgpuRenderResourceContext::new(wgpu_renderer.device.clone());
|
||||
|
|
Loading…
Reference in a new issue