Use unwrap_or_else to fix two or_fun_call and suppress one
This commit is contained in:
parent
07fd4788e1
commit
0f9dcd2515
|
@ -299,7 +299,8 @@ fn main2() {
|
||||||
let textures = renderer.get_textures();
|
let textures = renderer.get_textures();
|
||||||
let dpi_factor = window.window().scale_factor();
|
let dpi_factor = window.window().scale_factor();
|
||||||
let default_protocol_version = protocol::versions::protocol_name_to_protocol_version(
|
let default_protocol_version = protocol::versions::protocol_name_to_protocol_version(
|
||||||
opt.default_protocol_version.unwrap_or("".to_string()),
|
opt.default_protocol_version
|
||||||
|
.unwrap_or_else(|| "".to_string()),
|
||||||
);
|
);
|
||||||
let mut game = Game {
|
let mut game = Game {
|
||||||
server: server::Server::dummy_server(resource_manager.clone()),
|
server: server::Server::dummy_server(resource_manager.clone()),
|
||||||
|
|
|
@ -891,7 +891,7 @@ impl RawModel {
|
||||||
.texture_vars
|
.texture_vars
|
||||||
.get(&name[1..])
|
.get(&name[1..])
|
||||||
.cloned()
|
.cloned()
|
||||||
.unwrap_or("".to_owned());
|
.unwrap_or_else(|| "".to_owned());
|
||||||
return self.lookup_texture(&tex);
|
return self.lookup_texture(&tex);
|
||||||
}
|
}
|
||||||
name.to_owned()
|
name.to_owned()
|
||||||
|
|
|
@ -994,6 +994,7 @@ impl World {
|
||||||
self.load_chunk19_or_115(false, x, z, new, mask, data)
|
self.load_chunk19_or_115(false, x, z, new, mask, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::or_fun_call)]
|
||||||
fn load_chunk19_or_115(
|
fn load_chunk19_or_115(
|
||||||
&mut self,
|
&mut self,
|
||||||
read_biomes: bool,
|
read_biomes: bool,
|
||||||
|
@ -1068,6 +1069,7 @@ impl World {
|
||||||
mappings
|
mappings
|
||||||
.get(&id)
|
.get(&id)
|
||||||
.cloned()
|
.cloned()
|
||||||
|
// TODO: fix or_fun_call, but do not re-borrow self
|
||||||
.unwrap_or(block::Block::by_vanilla_id(
|
.unwrap_or(block::Block::by_vanilla_id(
|
||||||
id,
|
id,
|
||||||
self.protocol_version,
|
self.protocol_version,
|
||||||
|
|
Loading…
Reference in New Issue