clippy fixes
This commit is contained in:
parent
8785aa076a
commit
5eba1a3a1f
3 changed files with 7 additions and 11 deletions
|
@ -40,14 +40,14 @@ mod tests {
|
||||||
println!("about to add");
|
println!("about to add");
|
||||||
add(
|
add(
|
||||||
&link,
|
&link,
|
||||||
&file_name,
|
file_name,
|
||||||
&FileEnv::create(dir.path().to_string_lossy().to_string()),
|
&FileEnv::create(dir.path().to_string_lossy().to_string()),
|
||||||
)?;
|
)?;
|
||||||
println!("called add");
|
println!("called add");
|
||||||
|
|
||||||
//then
|
//then
|
||||||
println!("about to read file contents");
|
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");
|
println!("read file contents");
|
||||||
drop(dir);
|
drop(dir);
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ mod tests {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
//then
|
//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);
|
drop(dir);
|
||||||
|
|
||||||
let expected = vec![
|
let expected = vec![
|
||||||
|
|
10
src/lib.rs
10
src/lib.rs
|
@ -87,18 +87,14 @@ mod tests {
|
||||||
open: mock_file_open(HashMap::from([
|
open: mock_file_open(HashMap::from([
|
||||||
(
|
(
|
||||||
subs_file_name.to_string(),
|
subs_file_name.to_string(),
|
||||||
format!(
|
format!("{}/{}", subs_dir.path().to_string_lossy(), subs_file_name),
|
||||||
"{}/{}",
|
|
||||||
subs_dir.path().to_string_lossy(),
|
|
||||||
subs_file_name.to_string()
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
history_file_name.to_string(),
|
history_file_name.to_string(),
|
||||||
format!(
|
format!(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
history_dir.path().to_string_lossy(),
|
history_dir.path().to_string_lossy(),
|
||||||
history_file_name.to_string()
|
history_file_name
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
])),
|
])),
|
||||||
|
@ -107,7 +103,7 @@ mod tests {
|
||||||
};
|
};
|
||||||
|
|
||||||
//when
|
//when
|
||||||
run(&subs_file_name, &history_file_name, site, env)?;
|
run(subs_file_name, history_file_name, site, env)?;
|
||||||
//then
|
//then
|
||||||
drop(subs_dir);
|
drop(subs_dir);
|
||||||
drop(history_dir);
|
drop(history_dir);
|
||||||
|
|
|
@ -20,7 +20,7 @@ pub fn create_text_file(name: &str, data: &[u8]) -> Result<TempDir> {
|
||||||
let data = from_utf8(data)?;
|
let data = from_utf8(data)?;
|
||||||
let dir = tempdir()?;
|
let dir = tempdir()?;
|
||||||
let filename = format!("{}", &dir.path().join(name).display());
|
let filename = format!("{}", &dir.path().join(name).display());
|
||||||
let file = File::create(&filename)?;
|
let file = File::create(filename)?;
|
||||||
write!(&file, "{data}")?;
|
write!(&file, "{data}")?;
|
||||||
Ok(dir)
|
Ok(dir)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue