mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +00:00
Def cleanup (#3580)
* Remove impossible condition * Improve def error * Fmt
This commit is contained in:
parent
5ec226a416
commit
25ba6ea459
1 changed files with 3 additions and 5 deletions
|
@ -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 a new issue