Skip to content

Commit c7ce2dd

Browse files
authored
Merge branch 'develop' into fix/clippy-ci-stacks-lib-collapsible-else-if
2 parents cdd0e0a + 11823df commit c7ce2dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+704
-808
lines changed

clarity/src/vm/representations.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ guarded_string!(
8484
);
8585

8686
impl StacksMessageCodec for ClarityName {
87+
#[allow(clippy::needless_as_bytes)] // as_bytes isn't necessary, but verbosity is preferable in the codec impls
8788
fn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), codec_error> {
8889
// ClarityName can't be longer than vm::representations::MAX_STRING_LEN, which itself is
8990
// a u8, so we should be good here.
@@ -124,6 +125,7 @@ impl StacksMessageCodec for ClarityName {
124125
}
125126

126127
impl StacksMessageCodec for ContractName {
128+
#[allow(clippy::needless_as_bytes)] // as_bytes isn't necessary, but verbosity is preferable in the codec impls
127129
fn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), codec_error> {
128130
if self.as_bytes().len() < CONTRACT_MIN_NAME_LENGTH
129131
|| self.as_bytes().len() > CONTRACT_MAX_NAME_LENGTH

libsigner/src/v0/messages.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ pub struct PeerInfo {
283283
}
284284

285285
impl StacksMessageCodec for PeerInfo {
286+
#[allow(clippy::needless_as_bytes)] // as_bytes isn't necessary, but verbosity is preferable in the codec impls
286287
fn consensus_serialize<W: Write>(&self, fd: &mut W) -> Result<(), CodecError> {
287288
write_next(fd, &self.burn_block_height)?;
288289
write_next(fd, self.stacks_tip_consensus_hash.as_bytes())?;

pox-locking/src/events.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ use clarity::vm::costs::LimitedCostTracker;
2020
use clarity::vm::errors::Error as ClarityError;
2121
use clarity::vm::types::{PrincipalData, QualifiedContractIdentifier, ResponseData, TupleData};
2222
use clarity::vm::Value;
23-
#[cfg(test)]
23+
#[cfg(any(test, feature = "testing"))]
2424
use slog::slog_debug;
2525
use slog::slog_error;
26-
#[cfg(test)]
26+
#[cfg(any(test, feature = "testing"))]
2727
use stacks_common::debug;
2828
use stacks_common::types::StacksEpochId;
2929
use stacks_common::{error, test_debug};

pox-locking/src/events_24.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ use clarity::vm::contexts::GlobalContext;
1919
use clarity::vm::errors::Error as ClarityError;
2020
use clarity::vm::types::{PrincipalData, QualifiedContractIdentifier, TupleData};
2121
use clarity::vm::Value;
22-
#[cfg(test)]
22+
#[cfg(any(test, feature = "testing"))]
2323
use slog::slog_debug;
2424
use slog::slog_error;
25-
#[cfg(test)]
25+
#[cfg(any(test, feature = "testing"))]
2626
use stacks_common::debug;
2727
use stacks_common::{error, test_debug};
2828

stackslib/src/burnchains/affirmation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ fn inner_find_heaviest_block_commit_ptr(
937937
pub fn find_heaviest_block_commit<B: BurnchainHeaderReader>(
938938
burnchain_tx: &BurnchainDBTransaction,
939939
indexer: &B,
940-
prepare_phase_ops: &Vec<Vec<LeaderBlockCommitOp>>,
940+
prepare_phase_ops: &[Vec<LeaderBlockCommitOp>],
941941
anchor_threshold: u32,
942942
) -> Result<Option<(LeaderBlockCommitOp, Vec<Vec<bool>>, u64, u64)>, DBError> {
943943
let (pox_anchor_ptr, ancestors) =

stackslib/src/burnchains/bitcoin/bits.rs

Lines changed: 16 additions & 16 deletions
Large diffs are not rendered by default.

stackslib/src/burnchains/bitcoin/blocks.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl BitcoinMessageHandler for BitcoinBlockDownloader {
150150
None => panic!("No block header set"),
151151
Some(ref ipc_header) => {
152152
let block_hash = ipc_header.block_header.header.bitcoin_hash().clone();
153-
indexer.send_getdata(&vec![block_hash]).map(|_r| true)
153+
indexer.send_getdata(&[block_hash]).map(|_r| true)
154154
}
155155
}
156156
}
@@ -191,7 +191,7 @@ impl BitcoinMessageHandler for BitcoinBlockDownloader {
191191
);
192192

193193
// try again
194-
indexer.send_getdata(&vec![ipc_header.block_header.header.bitcoin_hash()])?;
194+
indexer.send_getdata(&[ipc_header.block_header.header.bitcoin_hash()])?;
195195
return Ok(true);
196196
}
197197

@@ -599,14 +599,14 @@ mod tests {
599599
})
600600
}
601601

602-
fn to_txid(inp: &Vec<u8>) -> Txid {
602+
fn to_txid(inp: &[u8]) -> Txid {
603603
let mut ret = [0; 32];
604604
let bytes = &inp[..inp.len()];
605605
ret.copy_from_slice(bytes);
606606
Txid(ret)
607607
}
608608

609-
fn to_block_hash(inp: &Vec<u8>) -> BurnchainHeaderHash {
609+
fn to_block_hash(inp: &[u8]) -> BurnchainHeaderHash {
610610
let mut ret = [0; 32];
611611
let bytes = &inp[..inp.len()];
612612
ret.copy_from_slice(bytes);

stackslib/src/burnchains/bitcoin/indexer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3149,7 +3149,7 @@ mod test {
31493149
assert_eq!(total_work_before, total_work_before_idempotent);
31503150

31513151
// fake block headers for mainnet 40319-40320, which is on a difficulty adjustment boundary
3152-
let bad_headers = vec![
3152+
let bad_headers = [
31533153
LoneBlockHeader {
31543154
header: BlockHeader {
31553155
version: 1,

stackslib/src/burnchains/bitcoin/network.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ impl BitcoinIndexer {
354354
}
355355

356356
/// Send a GetData message
357-
pub fn send_getdata(&mut self, block_hashes: &Vec<Sha256dHash>) -> Result<(), btc_error> {
357+
pub fn send_getdata(&mut self, block_hashes: &[Sha256dHash]) -> Result<(), btc_error> {
358358
assert!(!block_hashes.is_empty());
359359
let getdata_invs = block_hashes
360360
.iter()

stackslib/src/burnchains/bitcoin/spv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ impl SpvClient {
524524
/// * headers must be contiguous
525525
fn validate_header_integrity(
526526
start_height: u64,
527-
headers: &Vec<LoneBlockHeader>,
527+
headers: &[LoneBlockHeader],
528528
check_txcount: bool,
529529
) -> Result<(), btc_error> {
530530
if headers.is_empty() {

0 commit comments

Comments
 (0)