mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-03-17 20:28:03 +02:00
Small code cleanups.
This commit is contained in:
parent
9911cd0cd9
commit
084d3f4911
@ -44,6 +44,8 @@ for result in WalkBuilder::new("./").hidden(false).build() {
|
||||
See the documentation for `WalkBuilder` for many other options.
|
||||
*/
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
extern crate crossbeam;
|
||||
extern crate globset;
|
||||
#[macro_use]
|
||||
@ -78,15 +80,35 @@ pub enum Error {
|
||||
/// file partially succeeded.
|
||||
Partial(Vec<Error>),
|
||||
/// An error associated with a specific line number.
|
||||
WithLineNumber { line: u64, err: Box<Error> },
|
||||
WithLineNumber {
|
||||
/// The line number.
|
||||
line: u64,
|
||||
/// The underlying error.
|
||||
err: Box<Error>,
|
||||
},
|
||||
/// An error associated with a particular file path.
|
||||
WithPath { path: PathBuf, err: Box<Error> },
|
||||
WithPath {
|
||||
/// The file path.
|
||||
path: PathBuf,
|
||||
/// The underlying error.
|
||||
err: Box<Error>,
|
||||
},
|
||||
/// An error associated with a particular directory depth when recursively
|
||||
/// walking a directory.
|
||||
WithDepth { depth: usize, err: Box<Error> },
|
||||
WithDepth {
|
||||
/// The directory depth.
|
||||
depth: usize,
|
||||
/// The underlying error.
|
||||
err: Box<Error>,
|
||||
},
|
||||
/// An error that occurs when a file loop is detected when traversing
|
||||
/// symbolic links.
|
||||
Loop { ancestor: PathBuf, child: PathBuf },
|
||||
Loop {
|
||||
/// The ancestor file path in the loop.
|
||||
ancestor: PathBuf,
|
||||
/// The child file path in the loop.
|
||||
child: PathBuf,
|
||||
},
|
||||
/// An error that occurs when doing I/O, such as reading an ignore file.
|
||||
Io(io::Error),
|
||||
/// An error that occurs when trying to parse a glob.
|
||||
|
@ -24,7 +24,7 @@ use printer::{ColorSpecs, Printer};
|
||||
use unescape::unescape;
|
||||
use worker::{Worker, WorkerBuilder};
|
||||
|
||||
use {Result, version};
|
||||
use Result;
|
||||
|
||||
/// `Args` are transformed/normalized from `ArgMatches`.
|
||||
#[derive(Debug)]
|
||||
|
19
src/main.rs
19
src/main.rs
@ -1,5 +1,3 @@
|
||||
#![allow(dead_code, unused_imports)]
|
||||
|
||||
extern crate bytecount;
|
||||
#[macro_use]
|
||||
extern crate clap;
|
||||
@ -23,11 +21,10 @@ extern crate termcolor;
|
||||
extern crate winapi;
|
||||
|
||||
use std::error::Error;
|
||||
use std::io;
|
||||
use std::io::Write;
|
||||
use std::process;
|
||||
use std::result;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
|
||||
use std::sync::mpsc;
|
||||
use std::thread;
|
||||
@ -279,20 +276,6 @@ fn get_or_log_dir_entry(
|
||||
}
|
||||
}
|
||||
|
||||
fn version() -> String {
|
||||
let (maj, min, pat) = (
|
||||
option_env!("CARGO_PKG_VERSION_MAJOR"),
|
||||
option_env!("CARGO_PKG_VERSION_MINOR"),
|
||||
option_env!("CARGO_PKG_VERSION_PATCH"),
|
||||
);
|
||||
match (maj, min, pat) {
|
||||
(Some(maj), Some(min), Some(pat)) => {
|
||||
format!("ripgrep {}.{}.{}", maj, min, pat)
|
||||
}
|
||||
_ => "".to_owned(),
|
||||
}
|
||||
}
|
||||
|
||||
fn eprint_nothing_searched() {
|
||||
eprintln!("No files were searched, which means ripgrep probably \
|
||||
applied a filter you didn't expect. \
|
||||
|
@ -67,6 +67,7 @@ try!(bufwtr.print(&buffer));
|
||||
# Ok(()) }
|
||||
```
|
||||
*/
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
#[cfg(windows)]
|
||||
|
@ -17,6 +17,9 @@ con.reset().unwrap();
|
||||
println!("This text will be normal.");
|
||||
```
|
||||
*/
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
#[cfg(windows)]
|
||||
extern crate kernel32;
|
||||
#[cfg(windows)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user