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

Commit 2239a23

Browse files
authored
Merge pull request #168 from phansch/2018
Migrate to Rust 2018
2 parents 7010307 + e6b66f0 commit 2239a23

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ name = "rustfix"
88
description = "Automatically apply the suggestions made by rustc"
99
repository = "https://github.com/rust-lang-nursery/rustfix"
1010
documentation = "https://docs.rs/rustfix"
11+
edition = "2018"
1112
readme = "Readme.md"
1213
version = "0.4.4"
1314
exclude = [

examples/fix-json.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
extern crate failure;
2-
extern crate rustfix;
1+
2+
use rustfix;
33

44
use failure::Error;
55
use std::io::{stdin, BufReader, Read};

src/lib.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![warn(rust_2018_idioms)]
2+
13
#[macro_use]
24
extern crate log;
35
#[macro_use]
@@ -7,15 +9,15 @@ extern crate failure;
79
extern crate proptest;
810
#[macro_use]
911
extern crate serde_derive;
10-
extern crate serde_json;
12+
use serde_json;
1113

1214
use std::collections::HashSet;
1315
use std::ops::Range;
1416

1517
use failure::Error;
1618

1719
pub mod diagnostics;
18-
use diagnostics::{Diagnostic, DiagnosticSpan};
20+
use crate::diagnostics::{Diagnostic, DiagnosticSpan};
1921
mod replace;
2022

2123
#[derive(Debug, Clone, Copy)]
@@ -44,7 +46,7 @@ pub struct LinePosition {
4446
}
4547

4648
impl std::fmt::Display for LinePosition {
47-
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
49+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
4850
write!(f, "{}:{}", self.line, self.column)
4951
}
5052
}
@@ -56,7 +58,7 @@ pub struct LineRange {
5658
}
5759

5860
impl std::fmt::Display for LineRange {
59-
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
61+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
6062
write!(f, "{}-{}", self.start, self.end)
6163
}
6264
}
@@ -178,8 +180,8 @@ pub fn collect_suggestions<S: ::std::hash::BuildHasher>(
178180
.spans
179181
.iter()
180182
.filter(|span| {
181-
use Filter::*;
182-
use diagnostics::Applicability::*;
183+
use crate::Filter::*;
184+
use crate::diagnostics::Applicability::*;
183185

184186
match (filter, &span.suggestion_applicability) {
185187
(MachineApplicableOnly, Some(MachineApplicable)) => true,

tests/edge_cases.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extern crate rustfix;
1+
use rustfix;
22
use std::collections::HashSet;
33
use std::fs;
44

tests/parse_and_replace.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#![cfg(not(windows))] // TODO: should fix these tests on Windows
22

3-
extern crate duct;
4-
extern crate env_logger;
3+
use duct;
4+
use env_logger;
55
#[macro_use]
66
extern crate log;
7-
extern crate rustfix;
8-
extern crate serde_json;
9-
extern crate tempdir;
7+
use rustfix;
8+
9+
1010
#[macro_use]
1111
extern crate failure;
12-
extern crate difference;
12+
1313

1414
use std::collections::HashSet;
1515
use std::ffi::OsString;

0 commit comments

Comments
 (0)