mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-11 22:50:08 +00:00
fixed clippy warnings + tests compilation + cargo fmt
This commit is contained in:
@@ -93,9 +93,7 @@ impl AssetItem {
|
||||
|
||||
pub fn relative_path(&self) -> Result<PathBuf, std::io::Error> {
|
||||
let Some(resource_manager) = self.resource_manager.as_ref() else {
|
||||
return Err(std::io::Error::other(
|
||||
"No resource manager".to_string(),
|
||||
));
|
||||
return Err(std::io::Error::other("No resource manager".to_string()));
|
||||
};
|
||||
|
||||
if resource_manager
|
||||
|
||||
@@ -327,19 +327,18 @@ pub fn make_relative_path<P: AsRef<Path>>(path: P) -> Result<PathBuf, std::io::E
|
||||
let canon_path = dir
|
||||
.canonicalize()
|
||||
.map_err(|err| {
|
||||
std::io::Error::other(
|
||||
format!("Unable to canonicalize '{}'. Reason: {err}", dir.display()),
|
||||
)
|
||||
std::io::Error::other(format!(
|
||||
"Unable to canonicalize '{}'. Reason: {err}",
|
||||
dir.display()
|
||||
))
|
||||
})?
|
||||
.join(file_name);
|
||||
match canon_path.strip_prefix(std::env::current_dir()?.canonicalize()?) {
|
||||
Ok(relative_path) => Ok(replace_slashes(relative_path)),
|
||||
Err(err) => Err(std::io::Error::other(
|
||||
format!(
|
||||
"unable to strip prefix from '{}'! Reason: {err}",
|
||||
canon_path.display()
|
||||
),
|
||||
)),
|
||||
Err(err) => Err(std::io::Error::other(format!(
|
||||
"unable to strip prefix from '{}'! Reason: {err}",
|
||||
canon_path.display()
|
||||
))),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,8 +80,7 @@ impl NetStream {
|
||||
if self.tx_buffer.capacity() < std::mem::size_of::<T>() {
|
||||
self.tx_buffer.reserve(std::mem::size_of::<T>());
|
||||
}
|
||||
bincode::serialize_into(&mut self.tx_buffer, data)
|
||||
.map_err(io::Error::other)?;
|
||||
bincode::serialize_into(&mut self.tx_buffer, data).map_err(io::Error::other)?;
|
||||
self.stream
|
||||
.write_u32::<LittleEndian>(self.tx_buffer.len() as u32)?;
|
||||
self.stream.write_all(&self.tx_buffer)?;
|
||||
|
||||
@@ -1578,7 +1578,7 @@ mod test {
|
||||
&mut self,
|
||||
field: &str,
|
||||
value: Box<dyn Reflect>,
|
||||
func: &mut dyn FnMut(Result<Box<dyn Reflect>, Box<dyn Reflect>>),
|
||||
func: &mut dyn FnMut(Result<Box<dyn Reflect>, SetFieldError>),
|
||||
) {
|
||||
self.0.deref_mut().set_field(field, value, func)
|
||||
}
|
||||
|
||||
@@ -730,8 +730,7 @@ impl Chunk {
|
||||
if let Some(texture) =
|
||||
make_height_map_texture_internal(pixels, self.height_map_size)
|
||||
{
|
||||
let prev_texture =
|
||||
self.heightmap.replace(texture);
|
||||
let prev_texture = self.heightmap.replace(texture);
|
||||
self.update_quad_tree();
|
||||
return prev_texture;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user