clippy fixes
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful

This commit is contained in:
Paul Campbell 2023-08-06 08:30:34 +01:00
parent 8785aa076a
commit 5eba1a3a1f
3 changed files with 7 additions and 11 deletions

View file

@ -40,14 +40,14 @@ mod tests {
println!("about to add");
add(
&link,
&file_name,
file_name,
&FileEnv::create(dir.path().to_string_lossy().to_string()),
)?;
println!("called add");
//then
println!("about to read file contents");
let content: Vec<String> = read_text_file(&dir.path(), &file_name)?;
let content: Vec<String> = read_text_file(dir.path(), file_name)?;
println!("read file contents");
drop(dir);
@ -79,7 +79,7 @@ mod tests {
)?;
//then
let content: Vec<String> = read_text_file(&dir.path(), &file_name)?;
let content: Vec<String> = read_text_file(dir.path(), file_name)?;
drop(dir);
let expected = vec![

View file

@ -87,18 +87,14 @@ mod tests {
open: mock_file_open(HashMap::from([
(
subs_file_name.to_string(),
format!(
"{}/{}",
subs_dir.path().to_string_lossy(),
subs_file_name.to_string()
),
format!("{}/{}", subs_dir.path().to_string_lossy(), subs_file_name),
),
(
history_file_name.to_string(),
format!(
"{}/{}",
history_dir.path().to_string_lossy(),
history_file_name.to_string()
history_file_name
),
),
])),
@ -107,7 +103,7 @@ mod tests {
};
//when
run(&subs_file_name, &history_file_name, site, env)?;
run(subs_file_name, history_file_name, site, env)?;
//then
drop(subs_dir);
drop(history_dir);

View file

@ -20,7 +20,7 @@ pub fn create_text_file(name: &str, data: &[u8]) -> Result<TempDir> {
let data = from_utf8(data)?;
let dir = tempdir()?;
let filename = format!("{}", &dir.path().join(name).display());
let file = File::create(&filename)?;
let file = File::create(filename)?;
write!(&file, "{data}")?;
Ok(dir)
}