From 3069a25c6031e420345f6bfd208b01e5e70c5f2f Mon Sep 17 00:00:00 2001 From: Cassie Jones Date: Fri, 10 Jan 2020 22:37:27 -0500 Subject: [PATCH] Run cargo fmt --- toolchain/src/cpu.rs | 5 ++++- toolchain/src/cpu/test.rs | 1 + toolchain/src/inst.rs | 2 +- toolchain/src/inst/decode.rs | 2 +- toolchain/src/inst/encode.rs | 2 +- toolchain/src/main.rs | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 toolchain/src/cpu/test.rs diff --git a/toolchain/src/cpu.rs b/toolchain/src/cpu.rs index bca67d6..b5be390 100644 --- a/toolchain/src/cpu.rs +++ b/toolchain/src/cpu.rs @@ -1,5 +1,8 @@ -use std::ops::{Index, IndexMut}; use crate::inst::Reg; +use std::ops::{Index, IndexMut}; + +#[cfg(test)] +mod test; struct RegFile { values: [u8; 4], diff --git a/toolchain/src/cpu/test.rs b/toolchain/src/cpu/test.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/toolchain/src/cpu/test.rs @@ -0,0 +1 @@ + diff --git a/toolchain/src/inst.rs b/toolchain/src/inst.rs index 8792781..83fe047 100644 --- a/toolchain/src/inst.rs +++ b/toolchain/src/inst.rs @@ -1,5 +1,5 @@ -mod encode; mod decode; +mod encode; pub enum Reg { R0, diff --git a/toolchain/src/inst/decode.rs b/toolchain/src/inst/decode.rs index f85cbba..eb07ff4 100644 --- a/toolchain/src/inst/decode.rs +++ b/toolchain/src/inst/decode.rs @@ -1,5 +1,5 @@ -use std::io::{self, Read}; use crate::inst::Inst; +use std::io::{self, Read}; pub trait Decode { fn decode(code: &mut impl Read) -> io::Result>; diff --git a/toolchain/src/inst/encode.rs b/toolchain/src/inst/encode.rs index 6a50b07..ae7b0e9 100644 --- a/toolchain/src/inst/encode.rs +++ b/toolchain/src/inst/encode.rs @@ -1,5 +1,5 @@ -use std::io::{self, Write}; use crate::inst::Inst; +use std::io::{self, Write}; pub trait Encode { fn encode(&self, out: &mut impl Write) -> io::Result<()>; diff --git a/toolchain/src/main.rs b/toolchain/src/main.rs index 68e87a4..69a3e2c 100644 --- a/toolchain/src/main.rs +++ b/toolchain/src/main.rs @@ -1,5 +1,5 @@ -mod inst; mod cpu; +mod inst; fn main() { println!("Hello, world!"); -- 2.47.0