Skip to content

Commit

Permalink
Apply clippy cleanups.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnunley committed Dec 22, 2024
1 parent 12112fa commit be2565c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
25 changes: 5 additions & 20 deletions crates/kernel/src/builtins/bf_verbs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,7 @@ fn bf_verb_args(bf_args: &mut BfCallState<'_>) -> Result<BfRet, BfErr> {
return Err(BfErr::Code(E_INVARG));
}

let verbdef = match get_verbdef(obj, bf_args.args[1].clone(), bf_args) {
Ok(v) => v,
Err(e) => return Err(e),
};
let verbdef = get_verbdef(obj, bf_args.args[1].clone(), bf_args)?;
let args = verbdef.args();

// Output is {dobj, prep, iobj} as strings
Expand Down Expand Up @@ -351,10 +348,7 @@ fn bf_verb_code(bf_args: &mut BfCallState<'_>) -> Result<BfRet, BfErr> {
{
return Err(BfErr::Code(E_PERM));
}
let verbdef = match get_verbdef(obj, bf_args.args[1].clone(), bf_args) {
Ok(v) => v,
Err(e) => return Err(e),
};
let verbdef = get_verbdef(obj, bf_args.args[1].clone(), bf_args)?;

// If the verb is not binary type MOO, we don't support decompilation or listing
// of it yet.
Expand Down Expand Up @@ -427,10 +421,7 @@ fn bf_set_verb_code(bf_args: &mut BfCallState<'_>) -> Result<BfRet, BfErr> {
return Err(BfErr::Code(E_PERM));
}

let verbdef = match get_verbdef(obj, bf_args.args[1].clone(), bf_args) {
Ok(v) => v,
Err(e) => return Err(e),
};
let verbdef = get_verbdef(obj, bf_args.args[1].clone(), bf_args)?;

// Right now set_verb_code is going to always compile to LambdaMOO 1.8.x. binary type.
let binary_type = BinaryType::LambdaMoo18X;
Expand Down Expand Up @@ -552,10 +543,7 @@ fn bf_delete_verb(bf_args: &mut BfCallState<'_>) -> Result<BfRet, BfErr> {
return Err(BfErr::Code(E_PERM));
}

let verbdef = match get_verbdef(obj, bf_args.args[1].clone(), bf_args) {
Ok(v) => v,
Err(e) => return Err(e),
};
let verbdef = get_verbdef(obj, bf_args.args[1].clone(), bf_args)?;

bf_args
.world_state
Expand All @@ -582,10 +570,7 @@ fn bf_disassemble(bf_args: &mut BfCallState<'_>) -> Result<BfRet, BfErr> {
return Err(BfErr::Code(E_INVARG));
}

let verbdef = match get_verbdef(obj, bf_args.args[1].clone(), bf_args) {
Ok(v) => v,
Err(e) => return Err(e),
};
let verbdef = get_verbdef(obj, bf_args.args[1].clone(), bf_args)?;

if verbdef.binary_type() != BinaryType::LambdaMoo18X {
warn!(object=?bf_args.args[0], verb=?bf_args.args[1], binary_type=?verbdef.binary_type(),
Expand Down
2 changes: 1 addition & 1 deletion crates/kernel/src/tasks/vm_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl VmHost {
result = self
.vm_exec_state
.verb_dispatch(&exec_params, world_state, this, verb_name, args)
.unwrap_or_else(|e| ExecutionResult::PushError(e));
.unwrap_or_else(ExecutionResult::PushError);
continue;
}
ExecutionResult::DispatchVerb {
Expand Down

0 comments on commit be2565c

Please sign in to comment.