diagnostics no longer copies entire source string

This commit is contained in:
Sven Vogel 2023-09-15 23:46:46 +02:00
parent 1e029bd604
commit f02bfe7b34
2 changed files with 7 additions and 5 deletions

View File

@ -66,11 +66,17 @@ impl Diagnostics {
let info: DebugInfo = source.clone().into();
let context = self.source.get(&info.origin).unwrap()
.lines()
.nth(info.line)
.unwrap()
.trim();
self.err = Some(DebugNotice {
info,
msg: message,
ext: ext.into(),
source: self.source.get(&info.origin).unwrap().clone(),
source: context.to_string(),
});
}

View File

@ -446,10 +446,6 @@ impl std::fmt::Display for DebugNotice {
f.write_fmt(format_args!(
" somewhere in here:\n --> `{}`\n",
self.source
.lines()
.nth(self.info.line)
.unwrap()
.trim()
.bold()
.bright_white()
))