Skip to content

Commit af54069

Browse files
committed
edition: run 'cargo fix --edition --edition-idioms --all'
1 parent 77a9e99 commit af54069

File tree

36 files changed

+107
-137
lines changed

36 files changed

+107
-137
lines changed

crates/cli/src/human.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl error::Error for ParseSizeError {
5252
}
5353

5454
impl fmt::Display for ParseSizeError {
55-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
55+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5656
use self::ParseSizeErrorKind::*;
5757

5858
match self.kind {

crates/cli/src/lib.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,18 +158,12 @@ error message is crafted that typically tells the user how to fix the problem.
158158

159159
#![deny(missing_docs)]
160160

161-
extern crate atty;
162-
extern crate bstr;
163-
extern crate globset;
161+
use atty;
162+
164163
#[macro_use]
165164
extern crate lazy_static;
166165
#[macro_use]
167166
extern crate log;
168-
extern crate regex;
169-
extern crate same_file;
170-
extern crate termcolor;
171-
#[cfg(windows)]
172-
extern crate winapi_util;
173167

174168
mod decompress;
175169
mod escape;

crates/cli/src/pattern.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl error::Error for InvalidPatternError {
3535
}
3636

3737
impl fmt::Display for InvalidPatternError {
38-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
38+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3939
write!(
4040
f,
4141
"found invalid UTF-8 in pattern at byte offset {}: {} \

crates/cli/src/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ impl error::Error for CommandError {
4747
}
4848

4949
impl fmt::Display for CommandError {
50-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
50+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
5151
match self.kind {
5252
CommandErrorKind::Io(ref e) => e.fmt(f),
5353
CommandErrorKind::Stderr(ref bytes) => {

crates/core/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,7 @@ impl ArgMatches {
17201720
self.0.value_of_os(name)
17211721
}
17221722

1723-
fn values_of_os(&self, name: &str) -> Option<clap::OsValues> {
1723+
fn values_of_os(&self, name: &str) -> Option<clap::OsValues<'_>> {
17241724
self.0.values_of_os(name)
17251725
}
17261726
}

crates/core/logger.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ impl Logger {
2424
}
2525

2626
impl Log for Logger {
27-
fn enabled(&self, _: &log::Metadata) -> bool {
27+
fn enabled(&self, _: &log::Metadata<'_>) -> bool {
2828
// We set the log level via log::set_max_level, so we don't need to
2929
// implement filtering here.
3030
true
3131
}
3232

33-
fn log(&self, record: &log::Record) {
33+
fn log(&self, record: &log::Record<'_>) {
3434
match (record.file(), record.line()) {
3535
(Some(file), Some(line)) => {
3636
eprintln!(

crates/globset/benches/bench.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ tool itself, see the benchsuite directory.
44
*/
55
#![feature(test)]
66

7-
extern crate glob;
8-
extern crate globset;
9-
extern crate regex;
7+
use glob;
8+
9+
1010
extern crate test;
1111

1212
use globset::{Candidate, Glob, GlobMatcher, GlobSet, GlobSetBuilder};

crates/globset/src/glob.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl hash::Hash for Glob {
9898
}
9999

100100
impl fmt::Display for Glob {
101-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
101+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
102102
self.glob.fmt(f)
103103
}
104104
}
@@ -127,7 +127,7 @@ impl GlobMatcher {
127127
}
128128

129129
/// Tests whether the given path matches this pattern or not.
130-
pub fn is_match_candidate(&self, path: &Candidate) -> bool {
130+
pub fn is_match_candidate(&self, path: &Candidate<'_>) -> bool {
131131
self.re.is_match(&path.path)
132132
}
133133

@@ -157,7 +157,7 @@ impl GlobStrategic {
157157
}
158158

159159
/// Tests whether the given path matches this pattern or not.
160-
fn is_match_candidate(&self, candidate: &Candidate) -> bool {
160+
fn is_match_candidate(&self, candidate: &Candidate<'_>) -> bool {
161161
let byte_path = &*candidate.path;
162162

163163
match self.strategy {

crates/globset/src/lib.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,12 @@ or to enable case insensitive matching.
103103

104104
#![deny(missing_docs)]
105105

106-
extern crate aho_corasick;
107-
extern crate bstr;
108-
extern crate fnv;
106+
107+
108+
use fnv;
109109
#[macro_use]
110110
extern crate log;
111-
extern crate regex;
111+
use regex;
112112

113113
#[cfg(feature = "serde1")]
114114
extern crate serde;
@@ -228,7 +228,7 @@ impl ErrorKind {
228228
}
229229

230230
impl fmt::Display for Error {
231-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
231+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
232232
match self.glob {
233233
None => self.kind.fmt(f),
234234
Some(ref glob) => {
@@ -239,7 +239,7 @@ impl fmt::Display for Error {
239239
}
240240

241241
impl fmt::Display for ErrorKind {
242-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
242+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
243243
match *self {
244244
ErrorKind::InvalidRecursive
245245
| ErrorKind::UnclosedClass
@@ -317,7 +317,7 @@ impl GlobSet {
317317
///
318318
/// This takes a Candidate as input, which can be used to amortize the
319319
/// cost of preparing a path for matching.
320-
pub fn is_match_candidate(&self, path: &Candidate) -> bool {
320+
pub fn is_match_candidate(&self, path: &Candidate<'_>) -> bool {
321321
if self.is_empty() {
322322
return false;
323323
}
@@ -340,7 +340,7 @@ impl GlobSet {
340340
///
341341
/// This takes a Candidate as input, which can be used to amortize the
342342
/// cost of preparing a path for matching.
343-
pub fn matches_candidate(&self, path: &Candidate) -> Vec<usize> {
343+
pub fn matches_candidate(&self, path: &Candidate<'_>) -> Vec<usize> {
344344
let mut into = vec![];
345345
if self.is_empty() {
346346
return into;
@@ -374,7 +374,7 @@ impl GlobSet {
374374
/// cost of preparing a path for matching.
375375
pub fn matches_candidate_into(
376376
&self,
377-
path: &Candidate,
377+
path: &Candidate<'_>,
378378
into: &mut Vec<usize>,
379379
) {
380380
into.clear();
@@ -543,7 +543,7 @@ enum GlobSetMatchStrategy {
543543
}
544544

545545
impl GlobSetMatchStrategy {
546-
fn is_match(&self, candidate: &Candidate) -> bool {
546+
fn is_match(&self, candidate: &Candidate<'_>) -> bool {
547547
use self::GlobSetMatchStrategy::*;
548548
match *self {
549549
Literal(ref s) => s.is_match(candidate),
@@ -556,7 +556,7 @@ impl GlobSetMatchStrategy {
556556
}
557557
}
558558

559-
fn matches_into(&self, candidate: &Candidate, matches: &mut Vec<usize>) {
559+
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
560560
use self::GlobSetMatchStrategy::*;
561561
match *self {
562562
Literal(ref s) => s.matches_into(candidate, matches),
@@ -582,12 +582,12 @@ impl LiteralStrategy {
582582
self.0.entry(lit.into_bytes()).or_insert(vec![]).push(global_index);
583583
}
584584

585-
fn is_match(&self, candidate: &Candidate) -> bool {
585+
fn is_match(&self, candidate: &Candidate<'_>) -> bool {
586586
self.0.contains_key(candidate.path.as_bytes())
587587
}
588588

589589
#[inline(never)]
590-
fn matches_into(&self, candidate: &Candidate, matches: &mut Vec<usize>) {
590+
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
591591
if let Some(hits) = self.0.get(candidate.path.as_bytes()) {
592592
matches.extend(hits);
593593
}
@@ -606,15 +606,15 @@ impl BasenameLiteralStrategy {
606606
self.0.entry(lit.into_bytes()).or_insert(vec![]).push(global_index);
607607
}
608608

609-
fn is_match(&self, candidate: &Candidate) -> bool {
609+
fn is_match(&self, candidate: &Candidate<'_>) -> bool {
610610
if candidate.basename.is_empty() {
611611
return false;
612612
}
613613
self.0.contains_key(candidate.basename.as_bytes())
614614
}
615615

616616
#[inline(never)]
617-
fn matches_into(&self, candidate: &Candidate, matches: &mut Vec<usize>) {
617+
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
618618
if candidate.basename.is_empty() {
619619
return;
620620
}
@@ -636,15 +636,15 @@ impl ExtensionStrategy {
636636
self.0.entry(ext.into_bytes()).or_insert(vec![]).push(global_index);
637637
}
638638

639-
fn is_match(&self, candidate: &Candidate) -> bool {
639+
fn is_match(&self, candidate: &Candidate<'_>) -> bool {
640640
if candidate.ext.is_empty() {
641641
return false;
642642
}
643643
self.0.contains_key(candidate.ext.as_bytes())
644644
}
645645

646646
#[inline(never)]
647-
fn matches_into(&self, candidate: &Candidate, matches: &mut Vec<usize>) {
647+
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
648648
if candidate.ext.is_empty() {
649649
return;
650650
}
@@ -662,7 +662,7 @@ struct PrefixStrategy {
662662
}
663663

664664
impl PrefixStrategy {
665-
fn is_match(&self, candidate: &Candidate) -> bool {
665+
fn is_match(&self, candidate: &Candidate<'_>) -> bool {
666666
let path = candidate.path_prefix(self.longest);
667667
for m in self.matcher.find_overlapping_iter(path) {
668668
if m.start() == 0 {
@@ -672,7 +672,7 @@ impl PrefixStrategy {
672672
false
673673
}
674674

675-
fn matches_into(&self, candidate: &Candidate, matches: &mut Vec<usize>) {
675+
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
676676
let path = candidate.path_prefix(self.longest);
677677
for m in self.matcher.find_overlapping_iter(path) {
678678
if m.start() == 0 {
@@ -690,7 +690,7 @@ struct SuffixStrategy {
690690
}
691691

692692
impl SuffixStrategy {
693-
fn is_match(&self, candidate: &Candidate) -> bool {
693+
fn is_match(&self, candidate: &Candidate<'_>) -> bool {
694694
let path = candidate.path_suffix(self.longest);
695695
for m in self.matcher.find_overlapping_iter(path) {
696696
if m.end() == path.len() {
@@ -700,7 +700,7 @@ impl SuffixStrategy {
700700
false
701701
}
702702

703-
fn matches_into(&self, candidate: &Candidate, matches: &mut Vec<usize>) {
703+
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
704704
let path = candidate.path_suffix(self.longest);
705705
for m in self.matcher.find_overlapping_iter(path) {
706706
if m.end() == path.len() {
@@ -714,7 +714,7 @@ impl SuffixStrategy {
714714
struct RequiredExtensionStrategy(HashMap<Vec<u8>, Vec<(usize, Regex)>, Fnv>);
715715

716716
impl RequiredExtensionStrategy {
717-
fn is_match(&self, candidate: &Candidate) -> bool {
717+
fn is_match(&self, candidate: &Candidate<'_>) -> bool {
718718
if candidate.ext.is_empty() {
719719
return false;
720720
}
@@ -732,7 +732,7 @@ impl RequiredExtensionStrategy {
732732
}
733733

734734
#[inline(never)]
735-
fn matches_into(&self, candidate: &Candidate, matches: &mut Vec<usize>) {
735+
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
736736
if candidate.ext.is_empty() {
737737
return;
738738
}
@@ -753,11 +753,11 @@ struct RegexSetStrategy {
753753
}
754754

755755
impl RegexSetStrategy {
756-
fn is_match(&self, candidate: &Candidate) -> bool {
756+
fn is_match(&self, candidate: &Candidate<'_>) -> bool {
757757
self.matcher.is_match(candidate.path.as_bytes())
758758
}
759759

760-
fn matches_into(&self, candidate: &Candidate, matches: &mut Vec<usize>) {
760+
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
761761
for i in self.matcher.matches(candidate.path.as_bytes()) {
762762
matches.push(self.map[i]);
763763
}

crates/globset/src/pathutil.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub fn file_name_ext<'a>(name: &Cow<'a, [u8]>) -> Option<Cow<'a, [u8]>> {
6060
/// Normalizes a path to use `/` as a separator everywhere, even on platforms
6161
/// that recognize other characters as separators.
6262
#[cfg(unix)]
63-
pub fn normalize_path(path: Cow<[u8]>) -> Cow<[u8]> {
63+
pub fn normalize_path(path: Cow<'_, [u8]>) -> Cow<'_, [u8]> {
6464
// UNIX only uses /, so we're good.
6565
path
6666
}

0 commit comments

Comments
 (0)