Skip to content

Commit

Permalink
remove needless borrows (#544)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeSnake04 authored Mar 8, 2023
1 parent b7df55d commit 777fdc0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions rnote-fileformats/src/xoppformat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ mod tests {
fn setup() {
INIT.call_once(|| {
pretty_env_logger::init();
std::fs::create_dir_all(&std::path::PathBuf::from("./temp")).unwrap();
std::fs::create_dir_all(std::path::PathBuf::from("./temp")).unwrap();
});
}

Expand All @@ -1032,13 +1032,13 @@ mod tests {
setup();
let to_load = PathBuf::from("./tests/simple.xopp");
let to_save = PathBuf::from("./temp/simple.json");
let bytes = std::fs::read(&to_load)?;
let bytes = std::fs::read(to_load)?;

let xopp_format_loader = super::XoppFile::load_from_bytes(&bytes)?;

// Dumping a json with serde
let xpp_json = serde_json::to_string_pretty(&xopp_format_loader.xopp_root)?;
std::fs::write(&to_save, &xpp_json)?;
std::fs::write(to_save, xpp_json)?;

Ok(())
}
Expand All @@ -1048,13 +1048,13 @@ mod tests {
setup();
let to_load = PathBuf::from("./tests/image.xopp");
let to_save = PathBuf::from("./temp/image.json");
let bytes = std::fs::read(&to_load)?;
let bytes = std::fs::read(to_load)?;

let xopp_format_loader = super::XoppFile::load_from_bytes(&bytes)?;

// Dumping a json with serde
let xpp_json = serde_json::to_string_pretty(&xopp_format_loader.xopp_root)?;
std::fs::write(&to_save, &xpp_json)?;
std::fs::write(to_save, xpp_json)?;

Ok(())
}
Expand All @@ -1064,12 +1064,12 @@ mod tests {
setup();
let to_load = PathBuf::from("./tests/simple.xopp");
let to_save = PathBuf::from("./temp/simple-new.xopp");
let bytes = std::fs::read(&to_load)?;
let bytes = std::fs::read(to_load)?;

let xopp_file = super::XoppFile::load_from_bytes(&bytes)?;

let xopp_output = xopp_file.save_as_bytes("simple-new.xopp")?;
std::fs::write(&to_save, &xopp_output)?;
std::fs::write(to_save, xopp_output)?;

Ok(())
}
Expand All @@ -1079,12 +1079,12 @@ mod tests {
setup();
let to_load = PathBuf::from("./tests/image.xopp");
let to_save = PathBuf::from("./temp/image-new.xopp");
let bytes = std::fs::read(&to_load)?;
let bytes = std::fs::read(to_load)?;

let xopp_file = super::XoppFile::load_from_bytes(&bytes)?;

let xopp_output = xopp_file.save_as_bytes("image-new.xopp")?;
std::fs::write(&to_save, &xopp_output)?;
std::fs::write(to_save, xopp_output)?;

Ok(())
}
Expand Down

0 comments on commit 777fdc0

Please sign in to comment.