Remove pointless map_err calls.

This commit is contained in:
Tom Alexander 2023-10-17 11:56:36 -04:00
parent 05c64f53b1
commit d20b4a410b
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 8 additions and 13 deletions

View File

@ -35,3 +35,9 @@ impl From<&'static str> for CustomError {
CustomError::Static(value)
}
}
impl From<String> for CustomError {
fn from(value: String) -> Self {
CustomError::Text(value)
}
}

View File

@ -129,23 +129,12 @@ fn document_org_source<'b, 'g, 'r, 's>(
})
.collect::<Result<Vec<_>, _>>()?;
for setup_file in setup_files.iter().map(String::as_str) {
let (_, setup_file_settings) =
scan_for_in_buffer_settings(setup_file.into()).map_err(|err| {
eprintln!("{}", err);
nom::Err::Error(CustomError::Static(
"TODO: make this take an owned string so I can dump err.to_string() into it.",
))
})?;
let (_, setup_file_settings) = scan_for_in_buffer_settings(setup_file.into())?;
final_settings.extend(setup_file_settings);
}
final_settings.extend(document_settings);
let new_settings = apply_in_buffer_settings(final_settings, context.get_global_settings())
.map_err(|err| {
eprintln!("{}", err);
nom::Err::Error(CustomError::Static(
"TODO: make this take an owned string so I can dump err.to_string() into it.",
))
})?;
.map_err(|err| nom::Err::Error(CustomError::from(err)))?;
let new_context = context.with_global_settings(&new_settings);
let context = &new_context;