fixed clippy warnings + tests compilation + cargo fmt

This commit is contained in:
Dmitry Stepanov
2025-05-18 12:14:31 +03:00
parent d62a4b1558
commit fc631b1e0d
5 changed files with 12 additions and 17 deletions
+1 -3
View File
@@ -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
+8 -9
View File
@@ -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()
))),
}
}
+1 -2
View File
@@ -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)?;
+1 -1
View File
@@ -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)
}
+1 -2
View File
@@ -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;
}