1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use super::*;

impl Display for SourcePath {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        match self {
            SourcePath::Anonymous => f.write_str("<anonymous>"),
            SourcePath::Snippet(s) => f.write_str(s),
            #[cfg(not(feature = "url"))]
            SourcePath::Path(s) => write!(f, "{:?}", s),
            #[cfg(feature = "url")]
            SourcePath::Local(s) => f.write_str(s.as_str()),
            #[cfg(feature = "url")]
            SourcePath::Remote(s) => f.write_str(s.as_str()),
        }
    }
}

impl Display for Source {
    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
        for c in self.lines() {
            f.write_str(&c.chars)?;
            f.write_char('\n')?;
        }
        Ok(())
    }
}