Skip to content

Commit

Permalink
fix: Run clippy lints and add default VM trait (#80)
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Sover <[email protected]>
  • Loading branch information
exdx authored Feb 14, 2023
1 parent 056c8f0 commit 428a337
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/e2e/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async fn e2e() {
fs::create_dir(&plugins_dir).unwrap();
fs::copy(
&vm_plugin_path,
Path::new(&plugins_dir).join(&vm_id.to_string()),
Path::new(&plugins_dir).join(vm_id.to_string()),
)
.unwrap();

Expand Down Expand Up @@ -170,7 +170,7 @@ async fn e2e() {
}

if let Some(ci) = &status.cluster_info {
if ci.custom_chains.len() > 0 {
if !ci.custom_chains.is_empty() {
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion timestampvm/src/block/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ impl subnet::rpc::consensus::snowman::Block for Block {
}

async fn parent(&self) -> ids::Id {
self.parent_id.clone()
self.parent_id
}

async fn verify(&mut self) -> io::Result<()> {
Expand Down
2 changes: 1 addition & 1 deletion timestampvm/src/genesis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl Genesis {
)
})?;

let mut f = File::create(&file_path)?;
let mut f = File::create(file_path)?;
f.write_all(&d)?;

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion timestampvm/src/state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ impl State {
let db = self.db.read().await;

let blk_status_bytes = db.get(&block_with_status_key(blk_id)).await?;
let blk_status = BlockWithStatus::from_slice(&blk_status_bytes)?;
let blk_status = BlockWithStatus::from_slice(blk_status_bytes)?;

let mut blk = Block::from_slice(&blk_status.block_bytes)?;
blk.set_status(blk_status.status);
Expand Down
6 changes: 6 additions & 0 deletions timestampvm/src/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ pub struct Vm {
pub mempool: Arc<RwLock<VecDeque<Vec<u8>>>>,
}

impl Default for Vm {
fn default() -> Self {
Self::new()
}
}

impl Vm {
pub fn new() -> Self {
Self {
Expand Down

0 comments on commit 428a337

Please sign in to comment.