mirror of
https://github.com/FyroxEngine/Fyrox.git
synced 2026-10-12 02:02:20 +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> {
|
pub fn relative_path(&self) -> Result<PathBuf, std::io::Error> {
|
||||||
let Some(resource_manager) = self.resource_manager.as_ref() else {
|
let Some(resource_manager) = self.resource_manager.as_ref() else {
|
||||||
return Err(std::io::Error::other(
|
return Err(std::io::Error::other("No resource manager".to_string()));
|
||||||
"No resource manager".to_string(),
|
|
||||||
));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if resource_manager
|
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
|
let canon_path = dir
|
||||||
.canonicalize()
|
.canonicalize()
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
std::io::Error::other(
|
std::io::Error::other(format!(
|
||||||
format!("Unable to canonicalize '{}'. Reason: {err}", dir.display()),
|
"Unable to canonicalize '{}'. Reason: {err}",
|
||||||
)
|
dir.display()
|
||||||
|
))
|
||||||
})?
|
})?
|
||||||
.join(file_name);
|
.join(file_name);
|
||||||
match canon_path.strip_prefix(std::env::current_dir()?.canonicalize()?) {
|
match canon_path.strip_prefix(std::env::current_dir()?.canonicalize()?) {
|
||||||
Ok(relative_path) => Ok(replace_slashes(relative_path)),
|
Ok(relative_path) => Ok(replace_slashes(relative_path)),
|
||||||
Err(err) => Err(std::io::Error::other(
|
Err(err) => Err(std::io::Error::other(format!(
|
||||||
format!(
|
"unable to strip prefix from '{}'! Reason: {err}",
|
||||||
"unable to strip prefix from '{}'! Reason: {err}",
|
canon_path.display()
|
||||||
canon_path.display()
|
))),
|
||||||
),
|
|
||||||
)),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,8 +80,7 @@ impl NetStream {
|
|||||||
if self.tx_buffer.capacity() < std::mem::size_of::<T>() {
|
if self.tx_buffer.capacity() < std::mem::size_of::<T>() {
|
||||||
self.tx_buffer.reserve(std::mem::size_of::<T>());
|
self.tx_buffer.reserve(std::mem::size_of::<T>());
|
||||||
}
|
}
|
||||||
bincode::serialize_into(&mut self.tx_buffer, data)
|
bincode::serialize_into(&mut self.tx_buffer, data).map_err(io::Error::other)?;
|
||||||
.map_err(io::Error::other)?;
|
|
||||||
self.stream
|
self.stream
|
||||||
.write_u32::<LittleEndian>(self.tx_buffer.len() as u32)?;
|
.write_u32::<LittleEndian>(self.tx_buffer.len() as u32)?;
|
||||||
self.stream.write_all(&self.tx_buffer)?;
|
self.stream.write_all(&self.tx_buffer)?;
|
||||||
|
|||||||
@@ -1578,7 +1578,7 @@ mod test {
|
|||||||
&mut self,
|
&mut self,
|
||||||
field: &str,
|
field: &str,
|
||||||
value: Box<dyn Reflect>,
|
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)
|
self.0.deref_mut().set_field(field, value, func)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -730,8 +730,7 @@ impl Chunk {
|
|||||||
if let Some(texture) =
|
if let Some(texture) =
|
||||||
make_height_map_texture_internal(pixels, self.height_map_size)
|
make_height_map_texture_internal(pixels, self.height_map_size)
|
||||||
{
|
{
|
||||||
let prev_texture =
|
let prev_texture = self.heightmap.replace(texture);
|
||||||
self.heightmap.replace(texture);
|
|
||||||
self.update_quad_tree();
|
self.update_quad_tree();
|
||||||
return prev_texture;
|
return prev_texture;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user