Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Migrate to Rust 2018 #168

Merged
merged 1 commit into from
Apr 5, 2019
Merged
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ name = "rustfix"
description = "Automatically apply the suggestions made by rustc"
repository = "https://github.com/rust-lang-nursery/rustfix"
documentation = "https://docs.rs/rustfix"
edition = "2018"
readme = "Readme.md"
version = "0.4.4"
exclude = [
Expand Down
4 changes: 2 additions & 2 deletions examples/fix-json.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extern crate failure;
extern crate rustfix;

use rustfix;

use failure::Error;
use std::io::{stdin, BufReader, Read};
Expand Down
14 changes: 8 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![warn(rust_2018_idioms)]

#[macro_use]
extern crate log;
#[macro_use]
Expand All @@ -7,15 +9,15 @@ extern crate failure;
extern crate proptest;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
use serde_json;

use std::collections::HashSet;
use std::ops::Range;

use failure::Error;

pub mod diagnostics;
use diagnostics::{Diagnostic, DiagnosticSpan};
use crate::diagnostics::{Diagnostic, DiagnosticSpan};
mod replace;

#[derive(Debug, Clone, Copy)]
Expand Down Expand Up @@ -44,7 +46,7 @@ pub struct LinePosition {
}

impl std::fmt::Display for LinePosition {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}:{}", self.line, self.column)
}
}
Expand All @@ -56,7 +58,7 @@ pub struct LineRange {
}

impl std::fmt::Display for LineRange {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}-{}", self.start, self.end)
}
}
Expand Down Expand Up @@ -178,8 +180,8 @@ pub fn collect_suggestions<S: ::std::hash::BuildHasher>(
.spans
.iter()
.filter(|span| {
use Filter::*;
use diagnostics::Applicability::*;
use crate::Filter::*;
use crate::diagnostics::Applicability::*;

match (filter, &span.suggestion_applicability) {
(MachineApplicableOnly, Some(MachineApplicable)) => true,
Expand Down
2 changes: 1 addition & 1 deletion tests/edge_cases.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extern crate rustfix;
use rustfix;
use std::collections::HashSet;
use std::fs;

Expand Down
12 changes: 6 additions & 6 deletions tests/parse_and_replace.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#![cfg(not(windows))] // TODO: should fix these tests on Windows

extern crate duct;
extern crate env_logger;
use duct;
use env_logger;
#[macro_use]
extern crate log;
extern crate rustfix;
extern crate serde_json;
extern crate tempdir;
use rustfix;


#[macro_use]
extern crate failure;
extern crate difference;


use std::collections::HashSet;
use std::ffi::OsString;
Expand Down