November 2023 - Rust Nightly Update (#413)

* Update nightly

* Replace .get(0) with .first()

* allow new clippy lint

---------

Co-authored-by: GitHub Actions <>
Co-authored-by: Luke Parker <lukeparker5132@gmail.com>
This commit is contained in:
github-actions[bot]
2023-11-03 05:28:07 -04:00
committed by GitHub
parent ae449535ff
commit a2089c61fb
11 changed files with 15 additions and 13 deletions

View File

@@ -59,7 +59,7 @@ pub struct Block {
impl Block {
pub fn number(&self) -> usize {
match self.miner_tx.prefix.inputs.get(0) {
match self.miner_tx.prefix.inputs.first() {
Some(Input::Gen(number)) => (*number).try_into().unwrap(),
_ => panic!("invalid block, miner TX didn't have a Input::Gen"),
}

View File

@@ -360,7 +360,7 @@ impl RctSignatures {
self
.base
.encrypted_amounts
.get(0)
.first()
.expect("MLSAG with Bulletproofs didn't have any outputs"),
EncryptedAmount::Original { .. }
) {

View File

@@ -247,7 +247,7 @@ impl<R: RpcConnection> Rpc<R> {
// https://github.com/monero-project/monero/issues/8311
if res.as_hex.is_empty() {
match tx.prefix.inputs.get(0) {
match tx.prefix.inputs.first() {
Some(Input::Gen { .. }) => (),
_ => Err(RpcError::PrunedTransaction)?,
}
@@ -308,7 +308,7 @@ impl<R: RpcConnection> Rpc<R> {
match self.get_block(self.get_block_hash(number).await?).await {
Ok(block) => {
// Make sure this is actually the block for this number
match block.miner_tx.prefix.inputs.get(0) {
match block.miner_tx.prefix.inputs.first() {
Some(Input::Gen(actual)) => {
if usize::try_from(*actual).unwrap() == number {
Ok(block)
@@ -467,7 +467,7 @@ impl<R: RpcConnection> Rpc<R> {
}
b"status" => {
if bytes_res
.get(0)
.first()
.ok_or_else(|| io::Error::new(io::ErrorKind::Other, "status wasn't a string"))?
.as_slice() !=
b"OK"

View File

@@ -493,8 +493,9 @@ impl Scanner {
.iter()
// Filter to v2 miner TX outputs/RCT outputs since we're tracking the RCT output index
.filter(|output| {
((tx.prefix.version == 2) && matches!(tx.prefix.inputs.get(0), Some(Input::Gen(..)))) ||
output.amount.is_none()
let is_v2_miner_tx =
(tx.prefix.version == 2) && matches!(tx.prefix.inputs.first(), Some(Input::Gen(..)));
is_v2_miner_tx || output.amount.is_none()
})
.count(),
)