Update error.rs

This commit is contained in:
Shunsuke Shibayama 2024-08-21 11:40:37 +09:00
parent bc50ceeb6a
commit fc976d38c5

View file

@ -916,6 +916,20 @@ impl ErrorCore {
None
}
pub fn hints(&self) -> Vec<&str> {
self.sub_messages
.iter()
.filter_map(|sub| sub.hint.as_deref())
.collect()
}
pub fn mut_hints(&mut self) -> Vec<&mut String> {
self.sub_messages
.iter_mut()
.filter_map(|sub| sub.hint.as_mut())
.collect()
}
pub fn fmt_header(&self, color: Color, caused_by: &str, input: &str) -> String {
let loc = match self.loc {
Location::Range {