Added can_problem and Docs

This commit is contained in:
Richard Feldman 2020-02-29 16:30:25 -05:00
parent d5163fa4d4
commit a1b8c97039

View file

@ -12,8 +12,15 @@ pub struct Report {
} }
impl Report { impl Report {
pub fn problem(filename: PathBuf, problem: Problem) -> Self { pub fn can_problem(filename: PathBuf, problem: Problem) -> Self {
let text = ReportText::Plain("TODO convert Problem to ReportText".into()); let text = match problem {
Problem::UnusedDef(symbol, region) => {
panic!("TODO implelment me!");
}
_ => {
panic!("TODO implement others");
}
};
Report { filename, text } Report { filename, text }
} }
@ -39,6 +46,9 @@ pub enum ReportText {
/// A URL, which should be rendered as a hyperlink. /// A URL, which should be rendered as a hyperlink.
Url(Box<str>), Url(Box<str>),
/// The documentation for this symbol.
Docs(Symbol),
} }
impl ReportText { impl ReportText {
@ -83,6 +93,9 @@ impl ReportText {
src_lines, region src_lines, region
); );
} }
Docs(_) => {
panic!("TODO implment docs");
}
} }
} }