From 6bf83540fb2b7eeaa75e4213b57078f713ce304b Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sat, 2 Oct 2021 08:45:37 -0400 Subject: [PATCH] Rustfmt --- src/calc.rs | 10 +++++----- src/calc/entries.rs | 6 ++---- src/calc/entries/matrix.rs | 15 +++++++++------ src/calc/entries/number.rs | 15 +++++++++------ src/calc/entries/vector.rs | 12 ++++++++---- src/calc/errors.rs | 3 +-- src/calc/types.rs | 3 +-- src/event.rs | 9 +++++---- 8 files changed, 40 insertions(+), 33 deletions(-) diff --git a/src/calc.rs b/src/calc.rs index 72b1e4f..636a21e 100644 --- a/src/calc.rs +++ b/src/calc.rs @@ -11,10 +11,8 @@ use errors::{CalculatorError, CalculatorResult}; use operations::{ ArithmeticOperation, CalculatorOperation, CalculatorStateChange, MacroState, OpArgs, }; -use serde::ser::Serializer; -use serde::{Deserialize, Serialize}; -use std::collections::{BTreeMap, HashMap}; -use std::collections::{HashSet, VecDeque}; +use serde::{ser::Serializer, Deserialize, Serialize}; +use std::collections::{BTreeMap, HashMap, HashSet, VecDeque}; use types::{ CalculatorAlignment, CalculatorAngleMode, CalculatorConstant, CalculatorConstants, CalculatorDisplayMode, CalculatorMacro, CalculatorMacros, CalculatorRegisters, CalculatorState, @@ -307,7 +305,9 @@ impl Calculator { self.state = CalculatorState::WaitingForSetting; Ok(()) } - c => self.op(OPERATION_MAP.get(&c).ok_or(CalculatorError::NoSuchOperator(c))?), + c => self.op(OPERATION_MAP + .get(&c) + .ok_or(CalculatorError::NoSuchOperator(c))?), } } fn constant_input(&mut self, c: char) -> CalculatorResult<()> { diff --git a/src/calc/entries.rs b/src/calc/entries.rs index 12f24f2..2ba5666 100644 --- a/src/calc/entries.rs +++ b/src/calc/entries.rs @@ -4,13 +4,11 @@ mod matrix; mod number; mod vector; use super::errors::{CalculatorError, CalculatorResult}; -use crate::calc::types::CalculatorAngleMode; -use crate::calc::CalculatorDisplayMode; +use crate::calc::{types::CalculatorAngleMode, CalculatorDisplayMode}; pub use matrix::{Matrix, MatrixDimensions}; pub use number::Number; use serde::{Deserialize, Serialize}; -use std::cmp::PartialEq; -use std::fmt; +use std::{cmp::PartialEq, fmt}; pub use vector::{Vector, VectorDirection}; pub trait CalculatorEntry diff --git a/src/calc/entries/matrix.rs b/src/calc/entries/matrix.rs index c001e25..4c4a49f 100644 --- a/src/calc/entries/matrix.rs +++ b/src/calc/entries/matrix.rs @@ -1,9 +1,12 @@ -use super::VectorDirection; -use super::{Entry, Number, Vector}; -use crate::calc::errors::{CalculatorError, CalculatorResult}; -use crate::calc::types::CalculatorAngleMode; -use crate::calc::CalculatorDisplayMode; -use crate::CalculatorEntry; +use super::{Entry, Number, Vector, VectorDirection}; +use crate::{ + calc::{ + errors::{CalculatorError, CalculatorResult}, + types::CalculatorAngleMode, + CalculatorDisplayMode, + }, + CalculatorEntry, +}; use serde::{Deserialize, Serialize}; use std::fmt; diff --git a/src/calc/entries/number.rs b/src/calc/entries/number.rs index d396866..1fa765f 100644 --- a/src/calc/entries/number.rs +++ b/src/calc/entries/number.rs @@ -1,9 +1,12 @@ -use super::VectorDirection; -use super::{Entry, Matrix, Vector}; -use crate::calc::errors::{CalculatorError, CalculatorResult}; -use crate::calc::types::CalculatorAngleMode; -use crate::calc::CalculatorDisplayMode; -use crate::CalculatorEntry; +use super::{Entry, Matrix, Vector, VectorDirection}; +use crate::{ + calc::{ + errors::{CalculatorError, CalculatorResult}, + types::CalculatorAngleMode, + CalculatorDisplayMode, + }, + CalculatorEntry, +}; use serde::{Deserialize, Serialize}; use std::fmt; diff --git a/src/calc/entries/vector.rs b/src/calc/entries/vector.rs index 1118a8f..a8d18ad 100644 --- a/src/calc/entries/vector.rs +++ b/src/calc/entries/vector.rs @@ -1,8 +1,12 @@ use super::{Entry, Matrix, Number}; -use crate::calc::errors::{CalculatorError, CalculatorResult}; -use crate::calc::types::CalculatorAngleMode; -use crate::calc::CalculatorDisplayMode; -use crate::CalculatorEntry; +use crate::{ + calc::{ + errors::{CalculatorError, CalculatorResult}, + types::CalculatorAngleMode, + CalculatorDisplayMode, + }, + CalculatorEntry, +}; use serde::{Deserialize, Serialize}; use std::fmt; diff --git a/src/calc/errors.rs b/src/calc/errors.rs index 0414074..dbaf4bb 100644 --- a/src/calc/errors.rs +++ b/src/calc/errors.rs @@ -1,6 +1,5 @@ use confy::ConfyError; -use std::error; -use std::fmt; +use std::{error, fmt}; pub type CalculatorResult = Result; diff --git a/src/calc/types.rs b/src/calc/types.rs index ecb8b71..8adcb21 100644 --- a/src/calc/types.rs +++ b/src/calc/types.rs @@ -1,7 +1,6 @@ use super::entries::Entry; use serde::{Deserialize, Serialize}; -use std::collections::HashMap; -use std::fmt; +use std::{collections::HashMap, fmt}; /// The calculator state #[derive(Debug, Serialize, Deserialize)] diff --git a/src/event.rs b/src/event.rs index af22b1b..ca533b3 100644 --- a/src/event.rs +++ b/src/event.rs @@ -1,8 +1,9 @@ -use std::iter; -use std::sync::mpsc; +use std::{iter, sync::mpsc}; -use std::thread; -use std::time::{Duration, Instant}; +use std::{ + thread, + time::{Duration, Instant}, +}; use crossterm::event::{self, Event as CEvent, KeyEvent};