Fix redundant clones

This commit is contained in:
ice_iix 2020-06-29 18:48:07 -07:00
parent 8fb5491e15
commit 98dff0b390
4 changed files with 8 additions and 12 deletions

View File

@ -26,10 +26,7 @@ impl ChunkBuilder {
resources: Arc<RwLock<resources::Manager>>, resources: Arc<RwLock<resources::Manager>>,
textures: Arc<RwLock<render::TextureManager>>, textures: Arc<RwLock<render::TextureManager>>,
) -> ChunkBuilder { ) -> ChunkBuilder {
let models = Arc::new(RwLock::new(model::Factory::new( let models = Arc::new(RwLock::new(model::Factory::new(resources, textures)));
resources.clone(),
textures,
)));
let mut threads = vec![]; let mut threads = vec![];
let mut free = vec![]; let mut free = vec![];

View File

@ -1386,7 +1386,7 @@ impl TextureManager {
rel_height: 1.0, rel_height: 1.0,
is_rel: false, is_rel: false,
}; };
self.textures.insert(full_name.to_owned(), t.clone()); self.textures.insert(full_name, t.clone());
t t
} }
@ -1421,8 +1421,7 @@ impl TextureManager {
(height as f32) / (tex.height as f32), (height as f32) / (tex.height as f32),
); );
let old_name = mem::replace(&mut tex.name, format!("steven-dynamic:{}", name)); let old_name = mem::replace(&mut tex.name, format!("steven-dynamic:{}", name));
self.dynamic_textures self.dynamic_textures.insert(name.to_owned(), (tex, img));
.insert(name.to_owned(), (tex.clone(), img));
// We need to rename the texture itself so that get_texture calls // We need to rename the texture itself so that get_texture calls
// work with the new name // work with the new name
let mut old = self.textures.remove(&old_name).unwrap(); let mut old = self.textures.remove(&old_name).unwrap();

View File

@ -149,7 +149,7 @@ impl Server {
warn!("Server is running in offline mode"); warn!("Server is running in offline mode");
debug!("Login: {} {}", val.username, val.uuid); debug!("Login: {} {}", val.username, val.uuid);
let mut read = conn.clone(); let mut read = conn.clone();
let mut write = conn.clone(); let mut write = conn;
read.state = protocol::State::Play; read.state = protocol::State::Play;
write.state = protocol::State::Play; write.state = protocol::State::Play;
let rx = Self::spawn_reader(read); let rx = Self::spawn_reader(read);
@ -167,7 +167,7 @@ impl Server {
warn!("Server is running in offline mode"); warn!("Server is running in offline mode");
debug!("Login: {} {:?}", val.username, val.uuid); debug!("Login: {} {:?}", val.username, val.uuid);
let mut read = conn.clone(); let mut read = conn.clone();
let mut write = conn.clone(); let mut write = conn;
read.state = protocol::State::Play; read.state = protocol::State::Play;
write.state = protocol::State::Play; write.state = protocol::State::Play;
let rx = Self::spawn_reader(read); let rx = Self::spawn_reader(read);
@ -214,7 +214,7 @@ impl Server {
} }
let mut read = conn.clone(); let mut read = conn.clone();
let mut write = conn.clone(); let mut write = conn;
read.enable_encyption(&shared, true); read.enable_encyption(&shared, true);
write.enable_encyption(&shared, false); write.enable_encyption(&shared, false);

View File

@ -114,7 +114,7 @@ impl SunModel {
z: SIZE, z: SIZE,
texture_x: 1.0, texture_x: 1.0,
texture_y: 0.0, texture_y: 0.0,
texture: tex.clone(), texture: tex,
r: 255, r: 255,
g: 255, g: 255,
b: 255, b: 255,
@ -178,7 +178,7 @@ impl SunModel {
z: SIZE, z: SIZE,
texture_x: mpx + (1.0 / 4.0), texture_x: mpx + (1.0 / 4.0),
texture_y: mpy, texture_y: mpy,
texture: tex.clone(), texture: tex,
r: 255, r: 255,
g: 255, g: 255,
b: 255, b: 255,