Skip to content

Commit

Permalink
edition: switch to Rust 2018
Browse files Browse the repository at this point in the history
  • Loading branch information
BurntSushi committed Jan 11, 2020
1 parent c584a1d commit ed87b1e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 23 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ keywords = ["directory", "recursive", "walk", "iterator"]
categories = ["filesystem"]
license = "Unlicense/MIT"
exclude = ["/ci/*", "/.travis.yml", "/appveyor.yml"]
edition = "2018"

[badges]
travis-ci = { repository = "BurntSushi/walkdir" }
Expand Down
6 changes: 3 additions & 3 deletions src/dent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::fmt;
use std::fs::{self, FileType};
use std::path::{Path, PathBuf};

use error::Error;
use Result;
use crate::error::Error;
use crate::Result;

/// A directory entry.
///
Expand Down Expand Up @@ -352,7 +352,7 @@ impl Clone for DirEntry {
}

impl fmt::Debug for DirEntry {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "DirEntry({:?})", self.path)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::fmt;
use std::io;
use std::path::{Path, PathBuf};

use DirEntry;
use crate::DirEntry;

/// An error produced by recursively walking a directory.
///
Expand Down Expand Up @@ -221,7 +221,7 @@ impl error::Error for Error {
}

impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.inner {
ErrorInner::Io { path: None, ref err } => err.fmt(f),
ErrorInner::Io { path: Some(ref path), ref err } => write!(
Expand Down
22 changes: 8 additions & 14 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,7 @@ for entry in walker.filter_entry(|e| !is_hidden(e)) {
#![allow(unknown_lints)]

#[cfg(test)]
#[macro_use]
extern crate doc_comment;
extern crate same_file;
#[cfg(windows)]
extern crate winapi;
#[cfg(windows)]
extern crate winapi_util;

#[cfg(test)]
doctest!("../README.md");
doc_comment::doctest!("../README.md");

use std::cmp::{min, Ordering};
use std::fmt;
Expand All @@ -128,10 +119,10 @@ use std::vec;

use same_file::Handle;

pub use dent::DirEntry;
pub use crate::dent::DirEntry;
#[cfg(unix)]
pub use dent::DirEntryExt;
pub use error::Error;
pub use crate::dent::DirEntryExt;
pub use crate::error::Error;

mod dent;
mod error;
Expand Down Expand Up @@ -262,7 +253,10 @@ struct WalkDirOptions {
}

impl fmt::Debug for WalkDirOptions {
fn fmt(&self, f: &mut fmt::Formatter) -> result::Result<(), fmt::Error> {
fn fmt(
&self,
f: &mut fmt::Formatter<'_>,
) -> result::Result<(), fmt::Error> {
let sorter_str = if self.sorter.is_some() {
// FnMut isn't `Debug`
"Some(...)"
Expand Down
6 changes: 3 additions & 3 deletions src/tests/recursive.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::fs;
use std::path::PathBuf;

use tests::util::Dir;
use WalkDir;
use crate::tests::util::Dir;
use crate::WalkDir;

#[test]
fn send_sync_traits() {
use {FilterEntry, IntoIter};
use crate::{FilterEntry, IntoIter};

fn assert_send<T: Send>() {}
fn assert_sync<T: Sync>() {}
Expand Down
2 changes: 1 addition & 1 deletion src/tests/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::io;
use std::path::{Path, PathBuf};
use std::result;

use {DirEntry, Error};
use crate::{DirEntry, Error};

/// Create an error from a format!-like syntax.
#[macro_export]
Expand Down

0 comments on commit ed87b1e

Please sign in to comment.