2022-06-18 21:56:31 -07:00
|
|
|
use super::*;
|
2020-04-26 14:19:21 -07:00
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq)]
|
|
|
|
pub(crate) struct Suggestion<'src> {
|
2021-09-16 06:44:40 -07:00
|
|
|
pub(crate) name: &'src str,
|
2020-04-26 14:19:21 -07:00
|
|
|
pub(crate) target: Option<&'src str>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'src> Display for Suggestion<'src> {
|
|
|
|
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
|
|
|
write!(f, "Did you mean `{}`", self.name)?;
|
|
|
|
if let Some(target) = self.target {
|
2022-12-15 16:53:21 -08:00
|
|
|
write!(f, ", an alias for `{target}`")?;
|
2020-04-26 14:19:21 -07:00
|
|
|
}
|
|
|
|
write!(f, "?")
|
|
|
|
}
|
|
|
|
}
|