Apply rustfmt

This commit is contained in:
Marshall Pierce 2018-04-23 13:25:06 -05:00
parent 169522dd83
commit 747eed4500
9 changed files with 33 additions and 31 deletions

View File

@ -4,13 +4,13 @@ extern crate base64;
extern crate rand;
extern crate test;
use base64::display;
use base64::{decode, decode_config_buf, decode_config_slice, encode, encode_config_buf,
encode_config_slice, Base64Encoder, Config, MIME, STANDARD};
use base64::display;
use rand::Rng;
use std::io::Write;
use test::Bencher;
use rand::Rng;
#[bench]
fn encode_3b(b: &mut Bencher) {

View File

@ -1,7 +1,7 @@
use {Config, LineEnding, LineWrap};
use encode::{add_padding, encode_to_slice};
use line_wrap::line_wrap;
use std::cmp;
use {Config, LineEnding, LineWrap};
/// The output mechanism for ChunkedEncoder's encoded bytes.
pub trait Sink {
@ -167,14 +167,14 @@ fn max_input_length(encoded_buf_len: usize, config: &Config) -> Result<usize, Ch
pub mod tests {
extern crate rand;
use ::*;
use tests::random_config;
use super::*;
use tests::random_config;
use *;
use std::str;
use self::rand::Rng;
use self::rand::distributions::{IndependentSample, Range};
use self::rand::Rng;
#[test]
fn chunked_encode_empty() {

View File

@ -1,5 +1,5 @@
use {tables, CharacterSet, Config, STANDARD};
use byteorder::{BigEndian, ByteOrder};
use {tables, CharacterSet, Config, STANDARD};
use std::{error, fmt, str};
@ -534,12 +534,12 @@ fn decode_chunk_precise(
mod tests {
extern crate rand;
use tests::{assert_encode_sanity, random_config};
use encode::encode_config_buf;
use super::*;
use encode::encode_config_buf;
use tests::{assert_encode_sanity, random_config};
use self::rand::Rng;
use self::rand::distributions::{IndependentSample, Range};
use self::rand::Rng;
#[test]
fn decode_chunk_precise_writes_only_6_bytes() {

View File

@ -9,8 +9,8 @@
//! assert_eq!("base64: AAECAw==", format!("base64: {}", wrapper));
//! ```
use super::Config;
use super::chunked_encoder::{ChunkedEncoder, ChunkedEncoderError};
use super::Config;
use std::fmt::{Display, Formatter};
use std::{fmt, str};
@ -78,10 +78,10 @@ impl<'a, 'b: 'a> super::chunked_encoder::Sink for FormatterSink<'a, 'b> {
#[cfg(test)]
mod tests {
use super::*;
use super::super::*;
use super::super::chunked_encoder::tests::{chunked_encode_matches_normal_encode_random,
SinkTestHelper};
use super::super::*;
use super::*;
#[test]
fn basic_display() {

View File

@ -1,5 +1,5 @@
use {line_wrap, line_wrap_parameters, Config, LineWrap, STANDARD};
use byteorder::{BigEndian, ByteOrder};
use {line_wrap, line_wrap_parameters, Config, LineWrap, STANDARD};
///Encode arbitrary octets as base64.
///Returns a String.
@ -346,15 +346,15 @@ pub fn add_padding(input_len: usize, output: &mut [u8]) -> usize {
mod tests {
extern crate rand;
use {CharacterSet, Config, LineEnding, LineWrap, MIME, STANDARD, URL_SAFE_NO_PAD};
use tests::{assert_encode_sanity, random_config};
use decode::decode_config_buf;
use super::*;
use decode::decode_config_buf;
use tests::{assert_encode_sanity, random_config};
use {CharacterSet, Config, LineEnding, LineWrap, MIME, STANDARD, URL_SAFE_NO_PAD};
use self::rand::distributions::{IndependentSample, Range};
use self::rand::Rng;
use std;
use std::str;
use self::rand::Rng;
use self::rand::distributions::{IndependentSample, Range};
#[test]
fn encoded_size_correct_standard() {

View File

@ -1,7 +1,7 @@
use std::fmt;
use encode::encode_to_slice;
use {encode_config_slice, Config};
use std::fmt;
use std::io::{Result, Write};
use {encode_config_slice, Config};
// TODO clearer name
/// A `Write` proxy that base64-encodes written data and hands the result off to another writer.
@ -118,14 +118,14 @@ mod tests {
extern crate rand;
use super::Base64Encoder;
use {encode_config, encode_config_buf, URL_SAFE};
use tests::random_config;
use {encode_config, encode_config_buf, URL_SAFE};
use std::io::{Cursor, Write};
use std::str;
use self::rand::Rng;
use self::rand::distributions::range;
use self::rand::Rng;
#[test]
fn encode_three_bytes() {

View File

@ -55,16 +55,18 @@
//!
//! The `_slice` flavors of encode or decode will panic if the provided output slice is too small,
#![deny(missing_docs, trivial_casts, trivial_numeric_casts, unused_extern_crates,
unused_import_braces, unused_results, variant_size_differences, warnings)]
#![deny(
missing_docs, trivial_casts, trivial_numeric_casts, unused_extern_crates, unused_import_braces,
unused_results, variant_size_differences, warnings
)]
extern crate byteorder;
pub mod display;
mod tables;
mod chunked_encoder;
mod line_wrap;
pub mod display;
mod encoder;
mod line_wrap;
mod tables;
pub use encoder::Base64Encoder;
use line_wrap::{line_wrap, line_wrap_parameters};

View File

@ -163,8 +163,8 @@ mod tests {
use super::*;
use self::rand::Rng;
use self::rand::distributions::{IndependentSample, Range};
use self::rand::Rng;
#[test]
fn line_params_perfect_multiple_of_line_length_lf() {

View File

@ -1,13 +1,13 @@
extern crate rand;
use ::*;
use encode::encoded_size;
use line_wrap::line_wrap_parameters;
use *;
use std::str;
use self::rand::Rng;
use self::rand::distributions::{IndependentSample, Range};
use self::rand::Rng;
#[test]
fn roundtrip_random_config_short() {