Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed compiler warnings as directed by compiler hints. #191

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cmd/headers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub fn run(argv: &[&str]) -> CliResult<()> {
}
}

let mut wtr: Box<io::Write> =
let mut wtr: Box<dyn io::Write> =
if args.flag_just_names {
Box::new(io::stdout())
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl<R: io::Read + io::Seek, W: io::Write> IoState<R, W> {

impl Args {
fn new_io_state(&self)
-> CliResult<IoState<fs::File, Box<io::Write+'static>>> {
-> CliResult<IoState<fs::File, Box<dyn io::Write+'static>>> {
let rconf1 = Config::new(&Some(self.arg_input1.clone()))
.delimiter(self.flag_delimiter)
.no_headers(self.flag_no_headers)
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/partition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl Args {
}
}

type BoxedWriter = csv::Writer<Box<io::Write+'static>>;
type BoxedWriter = csv::Writer<Box<dyn io::Write+'static>>;

/// Generates unique filenames based on CSV values.
struct WriterGenerator {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl Args {
&self,
headers: &csv::ByteRecord,
start: usize,
) -> CliResult<csv::Writer<Box<io::Write+'static>>> {
) -> CliResult<csv::Writer<Box<dyn io::Write+'static>>> {
let dir = Path::new(&self.arg_outdir);
let path = dir.join(self.flag_filename.filename(&format!("{}", start)));
let spath = Some(path.display().to_string());
Expand Down
8 changes: 4 additions & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ impl Config {
}

pub fn writer(&self)
-> io::Result<csv::Writer<Box<io::Write+'static>>> {
-> io::Result<csv::Writer<Box<dyn io::Write+'static>>> {
Ok(self.from_writer(self.io_writer()?))
}

pub fn reader(&self)
-> io::Result<csv::Reader<Box<io::Read+'static>>> {
-> io::Result<csv::Reader<Box<dyn io::Read+'static>>> {
Ok(self.from_reader(self.io_reader()?))
}

Expand Down Expand Up @@ -260,7 +260,7 @@ impl Config {
}
}

pub fn io_reader(&self) -> io::Result<Box<io::Read+'static>> {
pub fn io_reader(&self) -> io::Result<Box<dyn io::Read+'static>> {
Ok(match self.path {
None => Box::new(io::stdin()),
Some(ref p) => {
Expand Down Expand Up @@ -290,7 +290,7 @@ impl Config {
.from_reader(rdr)
}

pub fn io_writer(&self) -> io::Result<Box<io::Write+'static>> {
pub fn io_writer(&self) -> io::Result<Box<dyn io::Write+'static>> {
Ok(match self.path {
None => Box::new(io::stdout()),
Some(ref p) => Box::new(fs::File::create(p)?),
Expand Down
2 changes: 1 addition & 1 deletion src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl FilenameTemplate {
/// that we do not output headers; the caller must do that if
/// desired.
pub fn writer<P>(&self, path: P, unique_value: &str)
-> io::Result<csv::Writer<Box<io::Write+'static>>>
-> io::Result<csv::Writer<Box<dyn io::Write+'static>>>
where P: AsRef<Path>
{
let filename = self.filename(unique_value);
Expand Down
4 changes: 2 additions & 2 deletions tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl Arbitrary for CsvRecord {
CsvRecord((0..size).map(|_| Arbitrary::arbitrary(g)).collect())
}

fn shrink(&self) -> Box<Iterator<Item=CsvRecord>+'static> {
fn shrink(&self) -> Box<dyn Iterator<Item=CsvRecord>+'static> {
Box::new(self.clone().unwrap()
.shrink().filter(|r| r.len() > 0).map(CsvRecord))
}
Expand Down Expand Up @@ -148,7 +148,7 @@ impl Arbitrary for CsvData {
}
}

fn shrink(&self) -> Box<Iterator<Item=CsvData>+'static> {
fn shrink(&self) -> Box<dyn Iterator<Item=CsvData>+'static> {
let len = if self.is_empty() { 0 } else { self[0].len() };
let mut rows: Vec<CsvData> =
self.clone()
Expand Down
2 changes: 1 addition & 1 deletion tests/workdir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use Csv;

static XSV_INTEGRATION_TEST_DIR: &'static str = "xit";

static NEXT_ID: atomic::AtomicUsize = atomic::ATOMIC_USIZE_INIT;
static NEXT_ID: atomic::AtomicUsize = atomic::AtomicUsize::new(0);

pub struct Workdir {
root: PathBuf,
Expand Down