From 758170ef3195741e7981dca310baffda345fd3d8 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 6 Dec 2020 01:19:22 +0000 Subject: [PATCH] formatting, some from rustfmt (manually picked) Signed-off-by: Ian Jackson --- src/global.rs | 7 +++---- src/imports.rs | 56 +++++++++++++++++++++++++------------------------- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/global.rs b/src/global.rs index bb4389df..1f4ff584 100644 --- a/src/global.rs +++ b/src/global.rs @@ -1325,7 +1325,7 @@ fn client_expire_old_clients() { impl ClientIterator for Any { type Ret = (); fn old(&mut self, _client: ClientId) -> Option<()> { - return Some(()) + Some(()) } } if let (_, Some(())) = Any.iter(&gref, max_age) { @@ -1337,8 +1337,7 @@ fn client_expire_old_clients() { struct Now(HashSet); impl ClientIterator for Now { type Ret = Impossible; - fn old(&mut self, client: ClientId) - -> Option { + fn old(&mut self, client: ClientId) -> Option { self.0.insert(client); None } @@ -1384,7 +1383,7 @@ fn global_expire_old_logs() { pub fn logs_periodic_expiry() { loop { - sleep(MAX_LOG_AGE/10); + sleep(MAX_LOG_AGE / 10); global_expire_old_logs(); } } diff --git a/src/imports.rs b/src/imports.rs index d1b4b045..6cf4562a 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -4,83 +4,83 @@ pub use std::borrow::Borrow; pub use std::borrow::Cow; -pub use std::cmp::{self, min, max, Ordering}; +pub use std::cmp::{self, max, min, Ordering}; pub use std::collections::VecDeque; -pub use std::collections::{HashMap, hash_map, HashSet}; +pub use std::collections::{hash_map, HashMap, HashSet}; pub use std::convert::{TryFrom, TryInto}; pub use std::env; pub use std::error::Error; pub use std::fmt::Formatter; pub use std::fmt::Write as _; -pub use std::fmt::{self, Display, Debug}; -pub use std::fs::File; +pub use std::fmt::{self, Debug, Display}; pub use std::fs; +pub use std::fs::File; pub use std::hash::Hash; pub use std::io; pub use std::io::ErrorKind; -pub use std::io::{BufReader, Read, BufRead, BufWriter, Write}; +pub use std::io::{BufRead, BufReader, BufWriter, Read, Write}; pub use std::io::{Seek, SeekFrom}; -pub use std::iter::repeat_with; pub use std::iter; +pub use std::iter::repeat_with; pub use std::marker::PhantomData; pub use std::mem; -pub use std::num::{Wrapping, TryFromIntError}; +pub use std::num::{TryFromIntError, Wrapping}; pub use std::ops::{Deref, DerefMut}; pub use std::os::unix; pub use std::os::unix::ffi::OsStrExt; pub use std::os::unix::process::CommandExt; pub use std::path::PathBuf; pub use std::process::{exit, Command}; -pub use std::str::FromStr; pub use std::str; +pub use std::str::FromStr; pub use std::string::ParseError; -pub use std::sync::{Arc, Mutex, MutexGuard, Condvar}; +pub use std::sync::{Arc, Condvar, Mutex, MutexGuard}; pub use std::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard}; pub use std::thread::{self, sleep}; pub use std::time::Duration; pub use std::time::Instant; -pub use anyhow::{Context, anyhow}; +pub use anyhow::{anyhow, Context}; pub use arrayvec::ArrayVec; pub use boolinator::Boolinator as _; pub use delegate::delegate; pub use either::{Either, Left, Right}; -pub use fehler::{throws, throw}; +pub use fehler::{throw, throws}; pub use flexi_logger::{self, LogSpecification}; pub use fs2::FileExt; pub use if_chain::if_chain; -pub use index_vec::{define_index_type, index_vec, IndexVec, IndexSlice}; +pub use index_vec::{define_index_type, index_vec, IndexSlice, IndexVec}; pub use itertools::{izip, EitherOrBoth, Itertools}; pub use lazy_static::lazy_static; +pub use log::{debug, error, info, trace, warn}; pub use log::{log, log_enabled}; -pub use log::{trace, debug, info, warn, error}; pub use nix::unistd::Uid; pub use num_traits::{Bounded, FromPrimitive, ToPrimitive}; pub use ordered_float::OrderedFloat; -pub use percent_encoding::NON_ALPHANUMERIC; pub use percent_encoding::percent_decode_str; pub use percent_encoding::utf8_percent_encode; -pub use rand::Rng; +pub use percent_encoding::NON_ALPHANUMERIC; pub use rand::distributions::Alphanumeric; pub use rand::thread_rng; +pub use rand::Rng; pub use regex::Regex; pub use rocket::http::Status; -pub use rocket::http::{RawStr, ContentType}; +pub use rocket::http::{ContentType, RawStr}; pub use rocket::request::Request; -pub use rocket::request::{FromParam, FromRequest, FromFormValue, LenientForm}; -pub use rocket::response::NamedFile; -pub use rocket::response::{Response, Responder}; +pub use rocket::request::{FromFormValue, FromParam, FromRequest, LenientForm}; pub use rocket::response; -pub use rocket::{State, Rocket}; -pub use rocket::{post, get, routes}; +pub use rocket::response::NamedFile; +pub use rocket::response::{Responder, Response}; +pub use rocket::{get, post, routes}; +pub use rocket::{Rocket, State}; pub use rocket_contrib::helmet::*; pub use rocket_contrib::json::Json; -pub use rocket_contrib::templates::Template; -pub use rocket_contrib::templates::Engines; pub use rocket_contrib::templates::tera::{self, Value}; +pub use rocket_contrib::templates::Engines; +pub use rocket_contrib::templates::Template; pub use serde::ser::SerializeTuple; -pub use serde::{Serialize, Deserialize, de::DeserializeOwned}; -pub use serde::{Serializer, Deserializer}; +pub use serde::{de::DeserializeOwned, Deserialize, Serialize}; +pub use serde::{Deserializer, Serializer}; pub use serde_with::DeserializeFromStr; pub use serde_with::SerializeDisplay; pub use slotmap::dense::DenseSlotMap; @@ -89,10 +89,10 @@ pub use thiserror::Error; pub use vecdeque_stableix::Deque as StableIndexVecDeque; pub use zcoord::{self, ZCoord}; +pub use crate::accounts::loaded_acl::{self, EffectiveACL, LoadedAcl, PermSet}; pub use crate::accounts::*; -pub use crate::accounts::loaded_acl::{self,LoadedAcl,EffectiveACL,PermSet}; -pub use crate::api::{Lens,TransparentLens,ApiPieceOpError}; -pub use crate::api::{PresentationLayout,AbbrevPresentationLayout}; +pub use crate::api::{AbbrevPresentationLayout, PresentationLayout}; +pub use crate::api::{ApiPieceOpError, Lens, TransparentLens}; pub use crate::cmdlistener::*; pub use crate::commands::*; pub use crate::config::*; -- 2.30.2