just/src/warning.rs
Casey Rodarmor 5995221555
Change dotenv-load default to false (#1082)
This changes the default value of `dotenv-load` from `true` to `false`. This
is a backwards incompatible change, and will require a minor version bump.
2022-02-02 03:16:35 +00:00

43 lines
895 B
Rust

use crate::common::*;
#[derive(Clone, Debug, PartialEq)]
pub(crate) enum Warning {}
impl Warning {
#[allow(clippy::unused_self)]
fn context(&self) -> Option<&Token> {
None
}
}
impl ColorDisplay for Warning {
fn fmt(&self, f: &mut Formatter, color: Color) -> fmt::Result {
let warning = color.warning();
let message = color.message();
write!(f, "{} {}", warning.paint("warning:"), message.prefix())?;
write!(f, "{}", message.suffix())?;
if let Some(token) = self.context() {
writeln!(f)?;
write!(f, "{}", token.color_display(color))?;
}
Ok(())
}
}
impl Serialize for Warning {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let mut map = serializer.serialize_map(None)?;
map.serialize_entry("message", &self.color_display(Color::never()).to_string())?;
map.end()
}
}