Use functors instead of parameters
This commit is contained in:
@@ -14,7 +14,7 @@ struct CommandLine {
|
||||
|
||||
fn configurate(cmd: &CommandLine) -> tool_helper::Result<Configuration> {
|
||||
let file_name = tool_helper::get_file_name_from_path_buf(&cmd.output_file, "output")?;
|
||||
let extension = tool_helper::os_str_to_string(Error::ok_or_new(cmd.output_file.extension(), "File extension required for output".to_owned(), None)?, "extension")?.to_ascii_lowercase();
|
||||
let extension = tool_helper::os_str_to_string(Error::ok_or_new(cmd.output_file.extension(), ||"File extension required for output".to_owned(), None)?, "extension")?.to_ascii_lowercase();
|
||||
let file_type = Error::ok_or_new({
|
||||
match extension.as_ref() {
|
||||
"h" => Some(FileType::CHeader),
|
||||
@@ -23,7 +23,7 @@ fn configurate(cmd: &CommandLine) -> tool_helper::Result<Configuration> {
|
||||
"cpp" => Some(FileType::CPPSource),
|
||||
_ => None
|
||||
}
|
||||
}, format!("{} unkown file extension", extension), None)?;
|
||||
}, ||format!("{} unkown file extension", extension), None)?;
|
||||
|
||||
Ok(Configuration{file_name, data_name: "Planschbecken".to_owned(), line_feed: cpp_out::LineFeed::Windows, file_type})
|
||||
}
|
||||
|
Reference in New Issue
Block a user