diagnostics no longer copies entire source string
This commit is contained in:
parent
1e029bd604
commit
f02bfe7b34
|
@ -66,11 +66,17 @@ impl Diagnostics {
|
||||||
|
|
||||||
let info: DebugInfo = source.clone().into();
|
let info: DebugInfo = source.clone().into();
|
||||||
|
|
||||||
|
let context = self.source.get(&info.origin).unwrap()
|
||||||
|
.lines()
|
||||||
|
.nth(info.line)
|
||||||
|
.unwrap()
|
||||||
|
.trim();
|
||||||
|
|
||||||
self.err = Some(DebugNotice {
|
self.err = Some(DebugNotice {
|
||||||
info,
|
info,
|
||||||
msg: message,
|
msg: message,
|
||||||
ext: ext.into(),
|
ext: ext.into(),
|
||||||
source: self.source.get(&info.origin).unwrap().clone(),
|
source: context.to_string(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -446,10 +446,6 @@ impl std::fmt::Display for DebugNotice {
|
||||||
f.write_fmt(format_args!(
|
f.write_fmt(format_args!(
|
||||||
" somewhere in here:\n --> `{}`\n",
|
" somewhere in here:\n --> `{}`\n",
|
||||||
self.source
|
self.source
|
||||||
.lines()
|
|
||||||
.nth(self.info.line)
|
|
||||||
.unwrap()
|
|
||||||
.trim()
|
|
||||||
.bold()
|
.bold()
|
||||||
.bright_white()
|
.bright_white()
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in New Issue