Follow up #8758 with a style fix (#8822)

# Description

The old comment around the question mark operator doesn't make sense
 to me based on the closure signature.
The `match` expressions were thus superfluous.


# User-Facing Changes

None

# Tests + Formatting

No change
This commit is contained in:
Stefan Holderbach 2023-04-10 03:42:43 +02:00 committed by GitHub
parent d0a83fec69
commit 0e23400510
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2840,20 +2840,11 @@ pub fn parse_register(working_set: &mut StateWorkingSet, spans: &[Span]) -> Pipe
};
// Extracting the required arguments from the call and keeping them together in a tuple
// The ? operator is not used because the error has to be kept to be printed in the shell
// For that reason the values are kept in a result that will be passed at the end of this call
let arguments = call
.positional_nth(0)
.map(|expr| {
let val = match eval_constant(working_set, expr) {
Ok(val) => val,
Err(err) => return Err(err),
};
let filename = match value_as_string(val, expr.span) {
Ok(str) => str,
Err(err) => return Err(err),
};
let val = eval_constant(working_set, expr)?;
let filename = value_as_string(val, expr.span)?;
let Some(path) = find_in_dirs(&filename, working_set, &cwd, PLUGIN_DIRS_VAR) else {
return Err(ParseError::RegisteredFileNotFound(filename, expr.span))