refactor: small adjustments

This commit is contained in:
timokoesters 2019-10-25 09:47:28 +02:00
parent 52dbfde510
commit 3ceb3a9d6d
No known key found for this signature in database
GPG Key ID: CD80BE9AAEE78097
2 changed files with 2 additions and 5 deletions

View File

@ -123,8 +123,7 @@ pub fn load<A: Asset + 'static>(specifier: &str) -> Result<Arc<A>, Error> {
/// Function used to load assets from the filesystem or the cache and return a clone.
pub fn load_cloned<A: Asset + Clone + 'static>(specifier: &str) -> Result<A, Error> {
let asset = load(specifier);
asset.map(|asset: Arc<A>| (*asset).clone())
load::<A>(specifier).map(|asset| (*asset).clone())
}
/// Function used to load essential assets from the filesystem or the cache. It will panic if the asset is not found.
@ -141,8 +140,7 @@ pub fn load_expect<A: Asset + 'static>(specifier: &str) -> Arc<A> {
/// Function used to load essential assets from the filesystem or the cache and return a clone. It will panic if the asset is not found.
pub fn load_expect_cloned<A: Asset + Clone + 'static>(specifier: &str) -> A {
let asset: Arc<A> = load_expect(specifier);
(*asset).clone()
load_expect::<A>(specifier).as_ref().clone()
}
/// Load an asset while registering it to be watched and reloaded when it changes

View File

@ -8,7 +8,6 @@ use specs::{Component, FlaggedStorage};
use specs_idvs::IDVStorage;
use std::fs::File;
use std::io::BufReader;
use std::sync::Arc;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Tool {