Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
edg-l committed May 8, 2024
1 parent b52af8a commit 5644d2f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
26 changes: 13 additions & 13 deletions crates/concrete_check/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn lowering_error_to_report(
program_id,
} => {
let offset = span.from;
let path = file_paths[program_id].to_str().unwrap().to_string();
let path = file_paths[program_id].display().to_string();
Report::build(ReportKind::Error, path.clone(), offset)
.with_code("ModuleNotFound")
.with_label(
Expand All @@ -33,7 +33,7 @@ pub fn lowering_error_to_report(
function,
program_id,
} => {
let path = file_paths[program_id].to_str().unwrap().to_string();
let path = file_paths[program_id].display().to_string();
Report::build(ReportKind::Error, path.clone(), span.from)
.with_code("FunctionNotFound")
.with_label(
Expand All @@ -48,7 +48,7 @@ pub fn lowering_error_to_report(
name,
program_id,
} => {
let path = file_paths[program_id].to_str().unwrap().to_string();
let path = file_paths[program_id].display().to_string();
Report::build(ReportKind::Error, path.clone(), span.from)
.with_code("StructFieldNotFound")
.with_label(
Expand All @@ -64,7 +64,7 @@ pub fn lowering_error_to_report(
symbol,
program_id,
} => {
let path = file_paths[program_id].to_str().unwrap().to_string();
let path = file_paths[program_id].display().to_string();
let offset = symbol.span.from;
Report::build(ReportKind::Error, path.clone(), offset)
.with_code("ImportNotFound")
Expand All @@ -90,7 +90,7 @@ pub fn lowering_error_to_report(
type_span,
program_id,
} => {
let path = file_paths[program_id].to_str().unwrap().to_string();
let path = file_paths[program_id].display().to_string();
let mut labels = vec![Label::new((path.clone(), span.into()))
.with_message(format!(
"Can't mutate {name:?} because it's behind a immutable borrow"
Expand All @@ -115,7 +115,7 @@ pub fn lowering_error_to_report(
name,
program_id,
} => {
let path = file_paths[program_id].to_str().unwrap().to_string();
let path = file_paths[program_id].display().to_string();
Report::build(ReportKind::Error, path.clone(), span.from)
.with_code("UnrecognizedType")
.with_label(
Expand All @@ -131,7 +131,7 @@ pub fn lowering_error_to_report(
id,
program_id,
} => {
let path = file_paths[program_id].to_str().unwrap().to_string();
let path = file_paths[program_id].display().to_string();
Report::build(ReportKind::Error, path.clone(), span.from)
.with_code("E_ID")
.with_label(
Expand All @@ -147,7 +147,7 @@ pub fn lowering_error_to_report(
message,
program_id,
} => {
let path = file_paths[program_id].to_str().unwrap().to_string();
let path = file_paths[program_id].display().to_string();
Report::build(ReportKind::Error, path.clone(), span.from)
.with_code("NotYetImplemented")
.with_label(
Expand All @@ -163,7 +163,7 @@ pub fn lowering_error_to_report(
expected,
program_id,
} => {
let path = file_paths[program_id].to_str().unwrap().to_string();
let path = file_paths[program_id].display().to_string();
let mut labels = vec![Label::new((path.clone(), span.into()))
.with_message(format!(
"Unexpected type '{}', expected '{}'",
Expand All @@ -190,7 +190,7 @@ pub fn lowering_error_to_report(
name,
program_id,
} => {
let path = file_paths[program_id].to_str().unwrap().to_string();
let path = file_paths[program_id].display().to_string();
Report::build(ReportKind::Error, path.clone(), span.from)
.with_code("UseOfUndeclaredVariable")
.with_label(
Expand All @@ -205,7 +205,7 @@ pub fn lowering_error_to_report(
name,
program_id,
} => {
let path = file_paths[program_id].to_str().unwrap().to_string();
let path = file_paths[program_id].display().to_string();
Report::build(ReportKind::Error, path.clone(), span.from)
.with_code("ExternFnWithBody")
.with_label(
Expand All @@ -216,7 +216,7 @@ pub fn lowering_error_to_report(
.finish()
}
LoweringError::InternalError(msg, program_id) => {
let path = file_paths[program_id].to_str().unwrap().to_string();
let path = file_paths[program_id].display().to_string();
Report::build(ReportKind::Error, path.clone(), 0)
.with_code("InternalError")
.with_message(msg)
Expand All @@ -228,7 +228,7 @@ pub fn lowering_error_to_report(
needs,
program_id,
} => {
let path = file_paths[program_id].to_str().unwrap().to_string();
let path = file_paths[program_id].display().to_string();
Report::build(ReportKind::Error, path.clone(), span.from)
.with_code("CallParamCountMismatch")
.with_label(
Expand Down
12 changes: 6 additions & 6 deletions crates/concrete_driver/tests/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ fn undeclared_var() {
}

#[test]
fn call_count_mismatch() {
fn call_param_count_mismatch() {
let (source, name) = (
include_str!("invalid_programs/call_count_mismatch.con"),
"call_count_mismatch",
include_str!("invalid_programs/call_param_count_mismatch.con"),
"call_param_count_mismatch",
);
let error = check_invalid_program(source, name);

Expand All @@ -122,10 +122,10 @@ fn call_count_mismatch() {
}

#[test]
fn invalid_call_params() {
fn call_param_type_mismatch() {
let (source, name) = (
include_str!("invalid_programs/invalid_call_params.con"),
"invalid_call_params",
include_str!("invalid_programs/call_param_type_mismatch.con"),
"call_param_type_mismatch",
);
let error = check_invalid_program(source, name);

Expand Down

0 comments on commit 5644d2f

Please sign in to comment.