Cleanup nightly warnings (#7055)

This commit is contained in:
Jack May 2019-11-19 20:15:37 -08:00 committed by GitHub
parent d32a072190
commit d2ed921bc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 19 deletions

View File

@ -1,10 +1,8 @@
#![feature(test)]
use rand;
extern crate test;
#[macro_use]
extern crate solana_ledger;
extern crate test;
use rand::Rng;
use solana_ledger::{

View File

@ -450,7 +450,7 @@ impl Archiver {
repair_socket: Arc<UdpSocket>,
shred_fetch_receiver: PacketReceiver,
slot_sender: Sender<u64>,
) -> Result<(WindowService)> {
) -> Result<WindowService> {
let slots_per_segment =
match Self::get_segment_config(&cluster_info, meta.client_commitment.clone()) {
Ok(slots_per_segment) => slots_per_segment,
@ -598,7 +598,7 @@ impl Archiver {
fn sample_file_to_create_mining_hash(
enc_file_path: &Path,
sampling_offsets: &[u64],
) -> Result<(Hash)> {
) -> Result<Hash> {
let sha_state = sample_file(enc_file_path, sampling_offsets)?;
info!("sampled sha_state: {}", sha_state);
Ok(sha_state)
@ -809,7 +809,7 @@ impl Archiver {
Error::IO(io::Error::new(ErrorKind::Other, "rpc error"))
})?;
let (storage_blockhash, turn_slot) =
serde_json::from_value::<((String, u64))>(response).map_err(|err| {
serde_json::from_value::<(String, u64)>(response).map_err(|err| {
io::Error::new(
io::ErrorKind::Other,
format!("Couldn't parse response: {:?}", err),
@ -851,7 +851,7 @@ impl Archiver {
archiver_info: &ContactInfo,
blocktree: &Arc<Blocktree>,
slots_per_segment: u64,
) -> Result<(u64)> {
) -> Result<u64> {
// Create a client which downloads from the archiver and see that it
// can respond with shreds.
let start_slot = Self::get_archiver_segment_slot(archiver_info.storage_addr);

View File

@ -637,7 +637,7 @@ impl ClusterInfo {
fanout: usize,
select_index: usize,
curr_index: usize,
) -> Option<(Locality)> {
) -> Option<Locality> {
let end = layer_indices.len() - 1;
let next = min(end, curr_index + 1);
let layer_start = layer_indices[curr_index];

View File

@ -791,7 +791,7 @@ mod test {
let mut account = Account::default();
account.lamports = 1;
let set: HashSet<u64> = vec![0u64, 1u64].into_iter().collect();
let ancestors: HashMap<u64, HashSet<u64>> = [(2u64, set)].into_iter().cloned().collect();
let ancestors: HashMap<u64, HashSet<u64>> = [(2u64, set)].iter().cloned().collect();
Tower::update_ancestor_stakes(&mut stake_lockouts, 2, account.lamports, &ancestors);
assert_eq!(stake_lockouts[&0].stake, 1);
assert_eq!(stake_lockouts[&1].stake, 1);

View File

@ -186,7 +186,7 @@ impl RepairService {
blocktree: &Blocktree,
max_repairs: usize,
repair_range: &RepairSlotRange,
) -> Result<(Vec<RepairType>)> {
) -> Result<Vec<RepairType>> {
// Slot height and shred indexes for shreds we want to repair
let mut repairs: Vec<RepairType> = vec![];
for slot in repair_range.start..=repair_range.end {
@ -218,7 +218,7 @@ impl RepairService {
blocktree: &Blocktree,
root: u64,
max_repairs: usize,
) -> Result<(Vec<RepairType>)> {
) -> Result<Vec<RepairType>> {
// Slot height and shred indexes for shreds we want to repair
let mut repairs: Vec<RepairType> = vec![];
Self::generate_repairs_for_fork(blocktree, &mut repairs, max_repairs, root);

View File

@ -1759,7 +1759,7 @@ fn handle_chaining_for_slot(
fn traverse_children_mut<F>(
db: &Database,
slot: Slot,
slot_meta: &Rc<RefCell<(SlotMeta)>>,
slot_meta: &Rc<RefCell<SlotMeta>>,
working_set: &HashMap<u64, SlotMetaWorkingSetEntry>,
new_chained_slots: &mut HashMap<u64, Rc<RefCell<SlotMeta>>>,
slot_function: F,
@ -1767,7 +1767,7 @@ fn traverse_children_mut<F>(
where
F: Fn(&mut SlotMeta) -> bool,
{
let mut next_slots: Vec<(u64, Rc<RefCell<(SlotMeta)>>)> = vec![(slot, slot_meta.clone())];
let mut next_slots: Vec<(u64, Rc<RefCell<SlotMeta>>)> = vec![(slot, slot_meta.clone())];
while !next_slots.is_empty() {
let (_, current_slot) = next_slots.pop().unwrap();
// Check whether we should explore the children of this slot

View File

@ -26,7 +26,7 @@ use crate::allocator_bump::BPFAllocator;
/// are expected to enforce this
const DEFAULT_HEAP_SIZE: usize = 32 * 1024;
pub fn register_helpers(vm: &mut EbpfVm) -> Result<(MemoryRegion), Error> {
pub fn register_helpers(vm: &mut EbpfVm) -> Result<MemoryRegion, Error> {
vm.register_helper_ex("abort", helper_abort, None)?;
vm.register_helper_ex("sol_panic", helper_sol_panic, None)?;
vm.register_helper_ex("sol_panic_", helper_sol_panic, None)?;
@ -55,7 +55,7 @@ pub fn helper_abort(
_context: &mut HelperContext,
_ro_regions: &[MemoryRegion],
_rw_regions: &[MemoryRegion],
) -> Result<(u64), Error> {
) -> Result<u64, Error> {
Err(Error::new(
ErrorKind::Other,
"Error: BPF program called abort()!",
@ -74,7 +74,7 @@ pub fn helper_sol_panic(
_context: &mut HelperContext,
ro_regions: &[MemoryRegion],
_rw_regions: &[MemoryRegion],
) -> Result<(u64), Error> {
) -> Result<u64, Error> {
if let Ok(host_addr) = translate_addr(file, len as usize, "Load", 0, ro_regions) {
let c_buf: *const c_char = host_addr as *const c_char;
let c_str: &CStr = unsafe { CStr::from_ptr(c_buf) };
@ -100,7 +100,7 @@ pub fn helper_sol_log(
_context: &mut HelperContext,
ro_regions: &[MemoryRegion],
_rw_regions: &[MemoryRegion],
) -> Result<(u64), Error> {
) -> Result<u64, Error> {
if log_enabled!(log::Level::Info) {
let host_addr = translate_addr(addr, len as usize, "Load", 0, ro_regions)?;
let c_buf: *const c_char = host_addr as *const c_char;
@ -133,7 +133,7 @@ pub fn helper_sol_log_u64(
_context: &mut HelperContext,
_ro_regions: &[MemoryRegion],
_rw_regions: &[MemoryRegion],
) -> Result<(u64), Error> {
) -> Result<u64, Error> {
if log_enabled!(log::Level::Info) {
info!(
"info!: {:#x}, {:#x}, {:#x}, {:#x}, {:#x}",
@ -158,7 +158,7 @@ pub fn helper_sol_alloc_free(
context: &mut HelperContext,
_ro_regions: &[MemoryRegion],
_rw_regions: &[MemoryRegion],
) -> Result<(u64), Error> {
) -> Result<u64, Error> {
if let Some(context) = context {
if let Some(allocator) = context.downcast_mut::<BPFAllocator>() {
return {