Remove unnecessary closure
Clippy emits: warning: unnecessary closure used to substitute value for `Option::None` As suggested, use `ok_or` removing the unnecessary closure.
This commit is contained in:
parent
dfff85352a
commit
c75189841a
|
@ -67,12 +67,12 @@ impl Decodable for Witness {
|
|||
let element_size = element_size_varint.0 as usize;
|
||||
let required_len = cursor
|
||||
.checked_add(element_size)
|
||||
.ok_or_else(|| self::Error::OversizedVectorAllocation {
|
||||
.ok_or(self::Error::OversizedVectorAllocation {
|
||||
requested: usize::max_value(),
|
||||
max: MAX_VEC_SIZE,
|
||||
})?
|
||||
.checked_add(element_size_varint_len)
|
||||
.ok_or_else(|| self::Error::OversizedVectorAllocation {
|
||||
.ok_or(self::Error::OversizedVectorAllocation {
|
||||
requested: usize::max_value(),
|
||||
max: MAX_VEC_SIZE,
|
||||
})?;
|
||||
|
|
|
@ -440,7 +440,7 @@ impl<R: Deref<Target = Transaction>> SighashCache<R> {
|
|||
.tx
|
||||
.input
|
||||
.get(input_index)
|
||||
.ok_or_else(|| Error::IndexOutOfInputsBounds {
|
||||
.ok_or(Error::IndexOutOfInputsBounds {
|
||||
index: input_index,
|
||||
inputs_size: self.tx.input.len(),
|
||||
})?;
|
||||
|
@ -473,7 +473,7 @@ impl<R: Deref<Target = Transaction>> SighashCache<R> {
|
|||
self.tx
|
||||
.output
|
||||
.get(input_index)
|
||||
.ok_or_else(|| Error::SingleWithoutCorrespondingOutput {
|
||||
.ok_or(Error::SingleWithoutCorrespondingOutput {
|
||||
index: input_index,
|
||||
outputs_size: self.tx.output.len(),
|
||||
})?
|
||||
|
@ -597,7 +597,7 @@ impl<R: Deref<Target = Transaction>> SighashCache<R> {
|
|||
.tx
|
||||
.input
|
||||
.get(input_index)
|
||||
.ok_or_else(|| Error::IndexOutOfInputsBounds {
|
||||
.ok_or(Error::IndexOutOfInputsBounds {
|
||||
index: input_index,
|
||||
inputs_size: self.tx.input.len(),
|
||||
})?;
|
||||
|
|
Loading…
Reference in New Issue