Use Rust 2018 idioms

This commit is contained in:
Vinzent Steinberg 2019-07-08 16:04:59 +02:00
parent 1bdadfae1b
commit 9401f41558
18 changed files with 39 additions and 39 deletions

View File

@ -1,10 +1,10 @@
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, map_clone))]
#[macro_use] extern crate bencher;
extern crate rand;
extern crate rand_xoshiro;
extern crate average;
use rand_xoshiro;
use average;
use bencher::Bencher;

View File

@ -1,11 +1,11 @@
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, map_clone))]
#[macro_use] extern crate bencher;
extern crate rand;
extern crate rand_xoshiro;
extern crate average;
extern crate stats;
use rand_xoshiro;
use average;
use stats;
use bencher::Bencher;

View File

@ -1,11 +1,11 @@
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, map_clone))]
#[macro_use] extern crate bencher;
extern crate rand;
extern crate rand_xoshiro;
extern crate average;
extern crate stats;
use rand_xoshiro;
use average;
use bencher::Bencher;

View File

@ -50,7 +50,7 @@ macro_rules! define_histogram {
}
impl ::core::fmt::Debug for Histogram {
fn fmt(&self, formatter: &mut ::core::fmt::Formatter)
fn fmt(&self, formatter: &mut ::core::fmt::Formatter<'_>)
-> ::core::fmt::Result {
formatter.write_str("Histogram {{ range: ")?;
self.range[..].fmt(formatter)?;
@ -154,7 +154,7 @@ macro_rules! define_histogram {
/// Return an iterator over the bins and corresponding ranges:
/// `((lower, upper), count)`
#[inline]
pub fn iter(&self) -> IterHistogram {
pub fn iter(&self) -> IterHistogram<'_> {
self.into_iter()
}

View File

@ -90,15 +90,15 @@
#![no_std]
extern crate conv;
extern crate float_ord;
#[cfg(feature = "serde1")]
extern crate serde;
#[cfg(feature = "serde1")]
#[macro_use] extern crate serde_derive;
#[cfg(feature = "serde1")]
#[macro_use] extern crate serde_big_array;
extern crate num_traits;
#[macro_use] mod macros;
#[macro_use] mod moments;

View File

@ -1,9 +1,9 @@
#[macro_use] extern crate average;
extern crate core;
extern crate rand;
extern crate rand_xoshiro;
extern crate rand_distr;
use rand_xoshiro;
use rand_distr;
#[cfg(feature = "serde1")]
#[macro_use] extern crate serde_derive;
#[cfg(feature = "serde1")]

View File

@ -2,7 +2,7 @@
#[macro_use] extern crate average;
extern crate core;
#[cfg(feature = "serde1")]
extern crate serde_json;

View File

@ -2,7 +2,7 @@
#[macro_use] extern crate average;
extern crate core;
use average::{Estimate, Min, Max};

View File

@ -1,8 +1,8 @@
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, map_clone))]
extern crate average;
extern crate core;
#[cfg(feature = "serde1")]
extern crate serde_json;

View File

@ -2,7 +2,7 @@
#[macro_use] extern crate average;
extern crate core;
#[cfg(feature = "serde")]
extern crate serde_json;

View File

@ -1,8 +1,8 @@
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, map_clone))]
extern crate average;
extern crate core;
#[cfg(feature = "serde1")]
extern crate serde_json;

View File

@ -2,7 +2,7 @@
#[macro_use] extern crate average;
extern crate core;
#[cfg(feature = "serde1")]
extern crate serde_json;

View File

@ -3,7 +3,7 @@
#[macro_use] extern crate average;
#[macro_use] extern crate proptest;
extern crate core;
use core::iter::Iterator;

View File

@ -1,9 +1,9 @@
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, map_clone))]
extern crate average;
#[cfg(feature = "serde1")]
extern crate serde_json;
extern crate quantiles;
use average::{Estimate, Quantile};
use quantiles::ckms::CKMS;

View File

@ -2,8 +2,8 @@
#[macro_use] extern crate average;
extern crate rand;
extern crate rand_distr;
use rand_distr;
use rand_distr::Distribution;

View File

@ -2,7 +2,7 @@
#[macro_use] extern crate average;
extern crate core;
#[cfg(feature = "serde1")]
extern crate serde_json;

View File

@ -2,10 +2,10 @@
#[macro_use] extern crate average;
extern crate rand;
extern crate rand_xoshiro;
extern crate rand_distr;
extern crate stats;
use stats;
/// Create a random vector by sampling from a normal distribution.
fn initialize_vec(size: usize) -> Vec<f64> {

View File

@ -2,7 +2,7 @@
#[macro_use] extern crate average;
extern crate core;
#[cfg(feature = "serde1")]
extern crate serde_json;