2019-09-21 18:53:30 -07:00
|
|
|
use crate::common::*;
|
|
|
|
|
2019-11-07 10:55:15 -08:00
|
|
|
#[derive(Debug, PartialEq)]
|
2021-03-28 23:39:23 -07:00
|
|
|
pub(crate) enum Warning {}
|
2019-09-21 18:53:30 -07:00
|
|
|
|
2021-03-28 23:39:23 -07:00
|
|
|
impl Warning {
|
|
|
|
fn context(&self) -> Option<&Token> {
|
|
|
|
#![allow(clippy::unused_self)]
|
|
|
|
unreachable!()
|
2019-09-21 18:53:30 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-28 23:39:23 -07:00
|
|
|
impl Display for Warning {
|
2019-09-21 18:53:30 -07:00
|
|
|
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
|
|
|
let warning = Color::fmt(f).warning();
|
|
|
|
let message = Color::fmt(f).message();
|
|
|
|
|
|
|
|
write!(f, "{} {}", warning.paint("warning:"), message.prefix())?;
|
|
|
|
|
|
|
|
write!(f, "{}", message.suffix())?;
|
|
|
|
|
|
|
|
if let Some(token) = self.context() {
|
|
|
|
writeln!(f)?;
|
2019-11-13 19:32:50 -08:00
|
|
|
token.write_context(f, Color::fmt(f).warning())?;
|
2019-09-21 18:53:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|