Def cleanup (#3580)

* Remove impossible condition

* Improve def error

* Fmt
This commit is contained in:
Jakub Žádník 2021-06-09 01:06:44 +03:00 committed by GitHub
parent 5ec226a416
commit 25ba6ea459
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,10 +29,6 @@ pub(crate) fn parse_definition(call: &LiteCommand, scope: &dyn ParserScope) -> O
// prototypes of adjacent commands are also available
if call.parts.len() == 4 {
if call.parts.len() != 4 {
return Some(ParseError::mismatch("definition", call.parts[0].clone()));
}
if call.parts[0].item != "def" {
return Some(ParseError::mismatch("definition", call.parts[0].clone()));
}
@ -81,7 +77,9 @@ pub(crate) fn parse_definition(call: &LiteCommand, scope: &dyn ParserScope) -> O
}
} else {
Some(ParseError::internal_error(
"need a block".to_string().spanned(call.span()),
"Wrong shape. Expected def name [signature] {body}."
.to_string()
.spanned(call.span()),
))
}
}