Resolve nightly-2021-10-05 clippy complaints

This commit is contained in:
Michael Vines
2021-10-05 22:24:48 -07:00
parent eb4ce3dfed
commit 7027d56064
53 changed files with 229 additions and 293 deletions

View File

@ -5,7 +5,7 @@ use crate::message::Message;
use crate::secp256k1_program;
use log::*;
#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug, AbiExample)]
#[derive(Serialize, Deserialize, Default, PartialEq, Eq, Clone, Debug, AbiExample)]
#[serde(rename_all = "camelCase")]
pub struct FeeCalculator {
// The current cost of a signature This amount may increase/decrease over time based on
@ -13,14 +13,6 @@ pub struct FeeCalculator {
pub lamports_per_signature: u64,
}
impl Default for FeeCalculator {
fn default() -> Self {
Self {
lamports_per_signature: 0,
}
}
}
impl FeeCalculator {
pub fn new(lamports_per_signature: u64) -> Self {
Self {

View File

@ -51,9 +51,10 @@ pub trait SyscallStubs: Sync + Send {
/// # Safety
unsafe fn sol_memcpy(&self, dst: *mut u8, src: *const u8, n: usize) {
// cannot be overlapping
if dst as usize + n > src as usize && src as usize > dst as usize {
panic!("memcpy does not support overlapping regions");
}
assert!(
!(dst as usize + n > src as usize && src as usize > dst as usize),
"memcpy does not support overlapping regions"
);
std::ptr::copy_nonoverlapping(src, dst, n as usize);
}
/// # Safety

View File

@ -45,9 +45,7 @@ macro_rules! declare_sysvar_id(
#[cfg(test)]
#[test]
fn test_sysvar_id() {
if !$crate::sysvar::is_sysvar_id(&id()) {
panic!("sysvar::is_sysvar_id() doesn't know about {}", $name);
}
assert!($crate::sysvar::is_sysvar_id(&id()), "sysvar::is_sysvar_id() doesn't know about {}", $name);
}
)
);
@ -72,10 +70,7 @@ macro_rules! declare_deprecated_sysvar_id(
#[cfg(test)]
#[test]
fn test_sysvar_id() {
#[allow(deprecated)]
if !$crate::sysvar::is_sysvar_id(&id()) {
panic!("sysvar::is_sysvar_id() doesn't know about {}", $name);
}
assert!($crate::sysvar::is_sysvar_id(&id()), "sysvar::is_sysvar_id() doesn't know about {}", $name);
}
)
);