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>>,
textures: Arc<RwLock<render::TextureManager>>,
) -> ChunkBuilder {
let models = Arc::new(RwLock::new(model::Factory::new(
resources.clone(),
textures,
)));
let models = Arc::new(RwLock::new(model::Factory::new(resources, textures)));
let mut threads = vec![];
let mut free = vec![];

View File

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

View File

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

View File

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