Revert "minor refactor"
This reverts commit 21f0b3a6220fdafb8f6aad6855de89d8cdde0e1b. Rationale: The absence of clause guard was here done *on purpose*. Indeed, introducing a clause guard here forces either duplication or the use of a wildcard which is not "future proof". Should we make a change to that one day (e.g. add a new variant to TraceLevel), we won't get any compiler warning and we'll very likely forget to update that particular section of the code. So as much as possible, enforce complete pattern-match on variants make for code that is easier to maintain in the long-run.
This commit is contained in:
parent
af90b38bf8
commit
2b4137dc24
|
@ -475,13 +475,17 @@ impl<'a> CodeGenerator<'a> {
|
||||||
let air_value = self.build(value, module_name);
|
let air_value = self.build(value, module_name);
|
||||||
|
|
||||||
let msg_func = match self.tracing {
|
let msg_func = match self.tracing {
|
||||||
TraceLevel::Verbose | TraceLevel::Compact if kind.is_expect() => {
|
TraceLevel::Silent => None,
|
||||||
|
TraceLevel::Verbose | TraceLevel::Compact => {
|
||||||
|
if kind.is_expect() {
|
||||||
let msg = match self.tracing {
|
let msg = match self.tracing {
|
||||||
TraceLevel::Silent => unreachable!("excluded from pattern guards"),
|
TraceLevel::Silent => unreachable!("excluded from pattern guards"),
|
||||||
TraceLevel::Compact => {
|
TraceLevel::Compact => get_line_columns_by_span(
|
||||||
get_line_columns_by_span(module_name, location, &self.module_src)
|
module_name,
|
||||||
.to_string()
|
location,
|
||||||
}
|
&self.module_src,
|
||||||
|
)
|
||||||
|
.to_string(),
|
||||||
TraceLevel::Verbose => {
|
TraceLevel::Verbose => {
|
||||||
get_src_code_by_span(module_name, location, &self.module_src)
|
get_src_code_by_span(module_name, location, &self.module_src)
|
||||||
}
|
}
|
||||||
|
@ -496,8 +500,10 @@ impl<'a> CodeGenerator<'a> {
|
||||||
);
|
);
|
||||||
|
|
||||||
Some(self.special_functions.use_function_msg(msg_func_name))
|
Some(self.special_functions.use_function_msg(msg_func_name))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => None,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.assignment(
|
self.assignment(
|
||||||
|
|
Loading…
Reference in New Issue