mirror of
https://gitee.com/openharmony/third_party_rust_rust-base64
synced 2024-12-11 15:05:35 +00:00
Apply rustfmt
This commit is contained in:
parent
169522dd83
commit
747eed4500
@ -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) {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
12
src/lib.rs
12
src/lib.rs
@ -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};
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user