1
0
Fork 0
mirror of synced 2025-09-24 04:40:05 +00:00

fix strip_prefix unwrapping in fmt_error

This commit is contained in:
dark64 2020-07-01 12:48:26 +02:00
parent 20bef00b9b
commit 54a87524bf

View file

@ -271,13 +271,11 @@ fn cli_compile<T: Field>(sub_matches: &ArgMatches) -> Result<(), String> {
reader.read_to_string(&mut source).unwrap();
let fmt_error = |e: &CompileError| {
let file = e.file().canonicalize().unwrap();
format!(
"{}:{}",
e.file()
.canonicalize()
.unwrap()
.strip_prefix(std::env::current_dir().unwrap())
.unwrap()
file.strip_prefix(std::env::current_dir().unwrap())
.unwrap_or(file.as_path())
.display(),
e.value()
)
@ -360,13 +358,11 @@ fn cli_check<T: Field>(sub_matches: &ArgMatches) -> Result<(), String> {
reader.read_to_string(&mut source).unwrap();
let fmt_error = |e: &CompileError| {
let file = e.file().canonicalize().unwrap();
format!(
"{}:{}",
e.file()
.canonicalize()
.unwrap()
.strip_prefix(std::env::current_dir().unwrap())
.unwrap()
file.strip_prefix(std::env::current_dir().unwrap())
.unwrap_or(file.as_path())
.display(),
e.value()
)