Moved to using checked arithmetic for Amounts. #351
Clippy (MSRV)
4 errors
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 4 |
Warning | 0 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.65.0 (897e37553 2022-11-02)
- cargo 1.65.0 (4bc8f24d3 2022-10-20)
- clippy 0.1.65 (897e375 2022-11-02)
Annotations
Check failure on line 341 in masp_primitives/src/transaction/components/amount.rs
github-actions / Clippy (MSRV)
this expression creates a reference which is immediately dereferenced by the compiler
error: this expression creates a reference which is immediately dereferenced by the compiler
--> masp_primitives/src/transaction/components/amount.rs:341:69
|
341 | comps.insert(atype.clone(), self.get(atype).checked_sub(&amount).expect("overflow detected"));
| ^^^^^^^ help: change this to: `amount`
|
= note: `-D clippy::needless-borrow` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check failure on line 100 in masp_primitives/src/transaction/components/amount.rs
github-actions / Clippy (MSRV)
use of `unwrap_or` followed by a call to `default`
error: use of `unwrap_or` followed by a call to `default`
--> masp_primitives/src/transaction/components/amount.rs:100:47
|
100 | let val = self.0.get(&index).copied().unwrap_or(Magnitude::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_default()`
|
= note: `-D clippy::or-fun-call` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call
Check failure on line 341 in masp_primitives/src/transaction/components/amount.rs
github-actions / Clippy (MSRV)
this expression creates a reference which is immediately dereferenced by the compiler
error: this expression creates a reference which is immediately dereferenced by the compiler
--> masp_primitives/src/transaction/components/amount.rs:341:69
|
341 | comps.insert(atype.clone(), self.get(atype).checked_sub(&amount).expect("overflow detected"));
| ^^^^^^^ help: change this to: `amount`
|
= note: `-D clippy::needless-borrow` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
Check failure on line 100 in masp_primitives/src/transaction/components/amount.rs
github-actions / Clippy (MSRV)
use of `unwrap_or` followed by a call to `default`
error: use of `unwrap_or` followed by a call to `default`
--> masp_primitives/src/transaction/components/amount.rs:100:47
|
100 | let val = self.0.get(&index).copied().unwrap_or(Magnitude::default());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_default()`
|
= note: `-D clippy::or-fun-call` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call