Cleanup BPF use syntax (#8001)

This commit is contained in:
Jack May 2020-01-28 17:03:37 -08:00 committed by GitHub
parent 83718a3b3e
commit 7faab2072c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 32 deletions

View File

@ -4,12 +4,7 @@ extern crate test;
use byteorder::{ByteOrder, LittleEndian, WriteBytesExt}; use byteorder::{ByteOrder, LittleEndian, WriteBytesExt};
use solana_rbpf::EbpfVm; use solana_rbpf::EbpfVm;
use std::env; use std::{env, fs::File, io::Error, io::Read, mem, path::PathBuf};
use std::fs::File;
use std::io::Error;
use std::io::Read;
use std::mem;
use std::path::PathBuf;
use test::Bencher; use test::Bencher;
/// BPF program file extension /// BPF program file extension

View File

@ -1,8 +1,6 @@
extern crate walkdir; extern crate walkdir;
use std::env; use std::{env, path::Path, process::Command};
use std::path::Path;
use std::process::Command;
use walkdir::WalkDir; use walkdir::WalkDir;
fn rerun_if_changed(files: &[&str], directories: &[&str], excludes: &[&str]) { fn rerun_if_changed(files: &[&str], directories: &[&str], excludes: &[&str]) {

View File

@ -1,12 +1,12 @@
#[cfg(any(feature = "bpf_c", feature = "bpf_rust"))] #[cfg(any(feature = "bpf_c", feature = "bpf_rust"))]
mod bpf { mod bpf {
use solana_runtime::bank::Bank; use solana_runtime::{
use solana_runtime::bank_client::BankClient; bank::Bank,
use solana_runtime::genesis_utils::{create_genesis_config, GenesisConfigInfo}; bank_client::BankClient,
use solana_runtime::loader_utils::load_program; genesis_utils::{create_genesis_config, GenesisConfigInfo},
use std::env; loader_utils::load_program,
use std::fs::File; };
use std::path::PathBuf; use std::{env, fs::File, path::PathBuf};
/// BPF program file extension /// BPF program file extension
const PLATFORM_FILE_EXTENSION_BPF: &str = "so"; const PLATFORM_FILE_EXTENSION_BPF: &str = "so";
@ -27,14 +27,15 @@ mod bpf {
mod bpf_c { mod bpf_c {
use super::*; use super::*;
use solana_runtime::loader_utils::create_invoke_instruction; use solana_runtime::loader_utils::create_invoke_instruction;
use solana_sdk::account::Account; use solana_sdk::{
use solana_sdk::bpf_loader; account::Account,
use solana_sdk::client::SyncClient; bpf_loader,
use solana_sdk::instruction::{AccountMeta, Instruction}; client::SyncClient,
use solana_sdk::signature::KeypairUtil; instruction::{AccountMeta, Instruction},
use std::io::Read; pubkey::Pubkey,
use std::sync::Arc; signature::KeypairUtil,
use solana_sdk::pubkey::Pubkey; };
use std::{io::Read, sync::Arc};
#[test] #[test]
fn test_program_bpf_c() { fn test_program_bpf_c() {
@ -156,14 +157,16 @@ mod bpf {
#[cfg(feature = "bpf_rust")] #[cfg(feature = "bpf_rust")]
mod bpf_rust { mod bpf_rust {
use super::*; use super::*;
use solana_sdk::account::Account; use solana_sdk::{
use solana_sdk::bpf_loader; account::Account,
use solana_sdk::client::SyncClient; bpf_loader,
use solana_sdk::clock::DEFAULT_SLOTS_PER_EPOCH; client::SyncClient,
use solana_sdk::instruction::{AccountMeta, Instruction}; clock::DEFAULT_SLOTS_PER_EPOCH,
use solana_sdk::pubkey::Pubkey; instruction::{AccountMeta, Instruction},
use solana_sdk::signature::{Keypair, KeypairUtil}; pubkey::Pubkey,
use solana_sdk::sysvar::{clock, fees, rent, rewards, slot_hashes, stake_history}; signature::{Keypair, KeypairUtil},
sysvar::{clock, fees, rent, rewards, slot_hashes, stake_history},
};
use std::io::Read; use std::io::Read;
use std::sync::Arc; use std::sync::Arc;