Skip to content

Commit 558c270

Browse files
DJMcNabItsDoot
authored andcommitted
Some minor cleanups of asset_server (bevyengine#4604)
# Objective - Code quality bad ## Solution - Code quality better - Using rust-analyzer's inline function and inline variable quick assists, I validated that the call to `AssetServer::new` is exactly the same code as the previous version.
1 parent 95df7c1 commit 558c270

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

crates/bevy_asset/src/asset_server.rs

+2-20
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,11 @@ pub struct AssetServerInternal {
6060
}
6161

6262
/// Loads assets from the filesystem on background threads
63+
#[derive(Clone)]
6364
pub struct AssetServer {
6465
pub(crate) server: Arc<AssetServerInternal>,
6566
}
6667

67-
impl Clone for AssetServer {
68-
fn clone(&self) -> Self {
69-
Self {
70-
server: self.server.clone(),
71-
}
72-
}
73-
}
74-
7568
impl AssetServer {
7669
pub fn new<T: AssetIo>(source_io: T, task_pool: TaskPool) -> Self {
7770
Self::with_boxed_io(Box::new(source_io), task_pool)
@@ -629,18 +622,7 @@ mod test {
629622
fn setup(asset_path: impl AsRef<Path>) -> AssetServer {
630623
use crate::FileAssetIo;
631624

632-
AssetServer {
633-
server: Arc::new(AssetServerInternal {
634-
loaders: Default::default(),
635-
extension_to_loader_index: Default::default(),
636-
asset_sources: Default::default(),
637-
asset_ref_counter: Default::default(),
638-
handle_to_path: Default::default(),
639-
asset_lifecycles: Default::default(),
640-
task_pool: Default::default(),
641-
asset_io: Box::new(FileAssetIo::new(asset_path, false)),
642-
}),
643-
}
625+
AssetServer::new(FileAssetIo::new(asset_path, false), Default::default())
644626
}
645627

646628
#[test]

0 commit comments

Comments
 (0)