Skip to content

Commit

Permalink
fixed mutable variable that could be assigned directly
Browse files Browse the repository at this point in the history
  • Loading branch information
calbaker committed Feb 19, 2024
1 parent 22c72ec commit d9a74c3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions rust/fastsim-core/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,19 @@ pub trait SerdeAPI: Serialize + for<'a> Deserialize<'a> {
.with_context(|| "Could not determine file name")?
.to_str()
.context("Could not determine file name.")?;
let mut subpath = PathBuf::new();
let file_path_internal = file_path
.as_ref()
.to_str()
.context("Could not determine file name.")?;
if file_name == file_path_internal {
subpath = PathBuf::from(Self::CACHE_FOLDER);
let subpath = if file_name == file_path_internal {
PathBuf::from(Self::CACHE_FOLDER)
} else {
subpath = Path::new(Self::CACHE_FOLDER).join(
Path::new(Self::CACHE_FOLDER).join(
file_path_internal
.strip_suffix(file_name)
.context("Could not determine path to subdirectory.")?,
);
}
)
};
let data_subdirectory = create_project_subdir(subpath)
.with_context(|| "Could not find or build Fastsim data subdirectory.")?;
let file_path = data_subdirectory.join(file_name);
Expand Down

0 comments on commit d9a74c3

Please sign in to comment.