[xmlparser] Use `TextPosition`s own `fmt`
TextPosition starts counting line numbers at 0. There is a ready made
implementation of `fmt::Display` that accounts for this when showing a
TextPosition to a human.
Use this implementation instead of manually showing the zero-indexed
line number.
@@ -37,13 +37,7 @@ struct ErrorEmitter {
impl ErrorEmitter {
pub fn emit(&self, message: &str, position: TextPosition) -> String {
let enriched = match self.path {
- Some(ref path) => format!(
- "{} at line {}:{}: {}",
- path.display(),
- position.row,
- position.column,
- message
- ),
+ Some(ref path) => format!("{} at line {}: {}", path.display(), position, message),
None => format!("{} {}", position, message),
};
format!("GirXml: {}", enriched)
