Attempt so simplify classified

This commit is contained in:
Jonathan Turner
2019-09-08 14:00:04 +12:00
parent 84628f298d
commit 9da896ad4e
3 changed files with 52 additions and 118 deletions

View File

@ -310,8 +310,7 @@ pub fn file_contents(full_path: impl AsRef<Path>) -> String {
pub fn file_contents_binary(full_path: impl AsRef<Path>) -> Vec<u8> {
let mut file = std::fs::File::open(full_path.as_ref()).expect("can not open file");
let mut contents = Vec::new();
file.read_to_end(&mut contents)
.expect("can not read file");
file.read_to_end(&mut contents).expect("can not read file");
contents
}
@ -327,18 +326,6 @@ pub fn line_ending() -> String {
}
}
pub fn normalize_string(input: &str) -> String {
#[cfg(windows)]
{
input.to_string()
}
#[cfg(not(windows))]
{
format!("\"{}\"", input)
}
}
pub fn create_file_at(full_path: impl AsRef<Path>) -> Result<(), std::io::Error> {
let full_path = full_path.as_ref();
@ -377,13 +364,13 @@ pub fn in_directory(str: impl AsRef<Path>) -> String {
str.as_ref().display().to_string()
}
pub fn pipeline(commands: &str) -> String {
commands.lines()
.skip(1)
.map(|line| line.trim())
.collect::<Vec<&str>>()
.join(" ")
.trim_end()
.to_string()
commands
.lines()
.skip(1)
.map(|line| line.trim())
.collect::<Vec<&str>>()
.join(" ")
.trim_end()
.to_string()
}