Skip to content

Commit e824531

Browse files
committed
edition: manual changes
This is mostly just about removing 'extern crate' everywhere and fixing the fallout.
1 parent af54069 commit e824531

File tree

34 files changed

+93
-182
lines changed

34 files changed

+93
-182
lines changed

Cargo.lock

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/cli/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,3 @@ Add this to your `Cargo.toml`:
2929
[dependencies]
3030
grep-cli = "0.1"
3131
```
32-
33-
and this to your crate root:
34-
35-
```rust
36-
extern crate grep_cli;
37-
```

crates/cli/src/decompress.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ impl DecompressionReaderBuilder {
230230
match self.command_builder.build(&mut cmd) {
231231
Ok(cmd_reader) => Ok(DecompressionReader { rdr: Ok(cmd_reader) }),
232232
Err(err) => {
233-
debug!(
233+
log::debug!(
234234
"{}: error spawning command '{:?}': {} \
235235
(falling back to uncompressed reader)",
236236
path.display(),
@@ -479,7 +479,7 @@ fn default_decompression_commands() -> Vec<DecompressionCommand> {
479479
let bin = match resolve_binary(Path::new(args[0])) {
480480
Ok(bin) => bin,
481481
Err(err) => {
482-
debug!("{}", err);
482+
log::debug!("{}", err);
483483
return;
484484
}
485485
};

crates/cli/src/human.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl From<ParseSizeError> for io::Error {
8888
///
8989
/// Additional suffixes may be added over time.
9090
pub fn parse_human_readable_size(size: &str) -> Result<u64, ParseSizeError> {
91-
lazy_static! {
91+
lazy_static::lazy_static! {
9292
// Normally I'd just parse something this simple by hand to avoid the
9393
// regex dep, but we bring regex in any way for glob matching, so might
9494
// as well use it.

crates/cli/src/lib.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,6 @@ error message is crafted that typically tells the user how to fix the problem.
158158

159159
#![deny(missing_docs)]
160160

161-
use atty;
162-
163-
#[macro_use]
164-
extern crate lazy_static;
165-
#[macro_use]
166-
extern crate log;
167-
168161
mod decompress;
169162
mod escape;
170163
mod human;

crates/cli/src/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl CommandReader {
254254
impl Drop for CommandReader {
255255
fn drop(&mut self) {
256256
if let Err(error) = self.close() {
257-
warn!("{}", error);
257+
log::warn!("{}", error);
258258
}
259259
}
260260
}

crates/globset/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ Add this to your `Cargo.toml`:
2222
globset = "0.3"
2323
```
2424

25-
and this to your crate root:
26-
27-
```rust
28-
extern crate globset;
29-
```
30-
3125
### Features
3226

3327
* `serde1`: Enables implementing Serde traits on the `Glob` type.

crates/globset/benches/bench.rs

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

7-
use glob;
8-
9-
107
extern crate test;
118

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

crates/globset/src/lib.rs

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

104104
#![deny(missing_docs)]
105105

106-
107-
108-
use fnv;
109-
#[macro_use]
110-
extern crate log;
111-
use regex;
112-
113-
#[cfg(feature = "serde1")]
114-
extern crate serde;
115-
116106
use std::borrow::Cow;
117107
use std::collections::{BTreeMap, HashMap};
118108
use std::error::Error as StdError;
@@ -423,12 +413,12 @@ impl GlobSet {
423413
required_exts.add(i, ext, p.regex().to_owned());
424414
}
425415
MatchStrategy::Regex => {
426-
debug!("glob converted to regex: {:?}", p);
416+
log::debug!("glob converted to regex: {:?}", p);
427417
regexes.add(i, p.regex().to_owned());
428418
}
429419
}
430420
}
431-
debug!(
421+
log::debug!(
432422
"built glob set; {} literals, {} basenames, {} extensions, \
433423
{} prefixes, {} suffixes, {} required extensions, {} regexes",
434424
lits.0.len(),
@@ -556,7 +546,11 @@ impl GlobSetMatchStrategy {
556546
}
557547
}
558548

559-
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
549+
fn matches_into(
550+
&self,
551+
candidate: &Candidate<'_>,
552+
matches: &mut Vec<usize>,
553+
) {
560554
use self::GlobSetMatchStrategy::*;
561555
match *self {
562556
Literal(ref s) => s.matches_into(candidate, matches),
@@ -587,7 +581,11 @@ impl LiteralStrategy {
587581
}
588582

589583
#[inline(never)]
590-
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
584+
fn matches_into(
585+
&self,
586+
candidate: &Candidate<'_>,
587+
matches: &mut Vec<usize>,
588+
) {
591589
if let Some(hits) = self.0.get(candidate.path.as_bytes()) {
592590
matches.extend(hits);
593591
}
@@ -614,7 +612,11 @@ impl BasenameLiteralStrategy {
614612
}
615613

616614
#[inline(never)]
617-
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
615+
fn matches_into(
616+
&self,
617+
candidate: &Candidate<'_>,
618+
matches: &mut Vec<usize>,
619+
) {
618620
if candidate.basename.is_empty() {
619621
return;
620622
}
@@ -644,7 +646,11 @@ impl ExtensionStrategy {
644646
}
645647

646648
#[inline(never)]
647-
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
649+
fn matches_into(
650+
&self,
651+
candidate: &Candidate<'_>,
652+
matches: &mut Vec<usize>,
653+
) {
648654
if candidate.ext.is_empty() {
649655
return;
650656
}
@@ -672,7 +678,11 @@ impl PrefixStrategy {
672678
false
673679
}
674680

675-
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
681+
fn matches_into(
682+
&self,
683+
candidate: &Candidate<'_>,
684+
matches: &mut Vec<usize>,
685+
) {
676686
let path = candidate.path_prefix(self.longest);
677687
for m in self.matcher.find_overlapping_iter(path) {
678688
if m.start() == 0 {
@@ -700,7 +710,11 @@ impl SuffixStrategy {
700710
false
701711
}
702712

703-
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
713+
fn matches_into(
714+
&self,
715+
candidate: &Candidate<'_>,
716+
matches: &mut Vec<usize>,
717+
) {
704718
let path = candidate.path_suffix(self.longest);
705719
for m in self.matcher.find_overlapping_iter(path) {
706720
if m.end() == path.len() {
@@ -732,7 +746,11 @@ impl RequiredExtensionStrategy {
732746
}
733747

734748
#[inline(never)]
735-
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
749+
fn matches_into(
750+
&self,
751+
candidate: &Candidate<'_>,
752+
matches: &mut Vec<usize>,
753+
) {
736754
if candidate.ext.is_empty() {
737755
return;
738756
}
@@ -757,7 +775,11 @@ impl RegexSetStrategy {
757775
self.matcher.is_match(candidate.path.as_bytes())
758776
}
759777

760-
fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec<usize>) {
778+
fn matches_into(
779+
&self,
780+
candidate: &Candidate<'_>,
781+
matches: &mut Vec<usize>,
782+
) {
761783
for i in self.matcher.matches(candidate.path.as_bytes()) {
762784
matches.push(self.map[i]);
763785
}

crates/grep/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,6 @@ Add this to your `Cargo.toml`:
2626
grep = "0.2"
2727
```
2828

29-
and this to your crate root:
30-
31-
```rust
32-
extern crate grep;
33-
```
34-
3529

3630
### Features
3731

0 commit comments

Comments
 (0)