Skip to content

Commit

Permalink
Prepare for Rust 2018
Browse files Browse the repository at this point in the history
  • Loading branch information
novacrazy committed Apr 14, 2019
1 parent 631d344 commit 1f59ef7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
3 changes: 2 additions & 1 deletion src/functional.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
use super::ArrayLength;
use core::iter::FromIterator;
use sequence::*;

use ::sequence::*;

/// Defines the relationship between one generic sequence and another,
/// for operations such as `map` and `zip`.
Expand Down
13 changes: 6 additions & 7 deletions src/hex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
//! ```
//!
use core::cmp::min;
use core::fmt;
use core::ops::Add;
use core::str;
use core::{fmt, str, ops::Add, cmp::min};

use typenum::*;
use {ArrayLength, GenericArray};

use ::{ArrayLength, GenericArray};

static LOWER_CHARS: &'static [u8] = b"0123456789abcdef";
static UPPER_CHARS: &'static [u8] = b"0123456789ABCDEF";
Expand All @@ -30,7 +29,7 @@ where
T: Add<T>,
<T as Add<T>>::Output: ArrayLength<u8>,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let max_digits = f.precision().unwrap_or_else(|| self.len() * 2);
let max_hex = (max_digits >> 1) + (max_digits & 1);

Expand Down Expand Up @@ -70,7 +69,7 @@ where
T: Add<T>,
<T as Add<T>>::Output: ArrayLength<u8>,
{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let max_digits = f.precision().unwrap_or_else(|| self.len() * 2);
let max_hex = (max_digits >> 1) + (max_digits & 1);

Expand Down
8 changes: 5 additions & 3 deletions src/impls.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
use super::{ArrayLength, GenericArray};
use core::borrow::{Borrow, BorrowMut};
use core::cmp::Ordering;
use core::fmt::{self, Debug};
use core::hash::{Hash, Hasher};
use functional::*;
use sequence::*;

use super::{ArrayLength, GenericArray};

use ::functional::*;
use ::sequence::*;

impl<T: Default, N> Default for GenericArray<T, N>
where
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ pub mod functional;
pub mod iter;
pub mod sequence;

use functional::*;
pub use iter::GenericArrayIter;
use sequence::*;
use self::functional::*;
pub use self::iter::GenericArrayIter;
use self::sequence::*;

/// Trait making `GenericArray` work, marking types to be used as length of an array
pub unsafe trait ArrayLength<T>: Unsigned {
Expand Down Expand Up @@ -616,7 +616,7 @@ mod test {

#[test]
fn test_assembly() {
use functional::*;
use ::functional::*;

let a = black_box(arr![i32; 1, 3, 5, 7]);
let b = black_box(arr![i32; 2, 4, 6, 8]);
Expand Down

0 comments on commit 1f59ef7

Please sign in to comment.