forked from extern/nushell
Def cleanup (#3580)
* Remove impossible condition * Improve def error * Fmt
This commit is contained in:
parent
5ec226a416
commit
25ba6ea459
@ -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()),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user