edition: switch to Rust 2018

This commit is contained in:
Andrew Gallant 2020-01-11 13:38:37 -05:00
parent c584a1d56c
commit ed87b1ee21
No known key found for this signature in database
GPG Key ID: B2E3A4923F8B0D44
6 changed files with 18 additions and 23 deletions

View File

@ -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" }

View File

@ -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.
///
@ -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)
}
}

View File

@ -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.
///
@ -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!(

View File

@ -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;
@ -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;
@ -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(...)"

View File

@ -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>() {}

View File

@ -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]