Skip to content

Commit

Permalink
Rollup merge of rust-lang#60521 - rasendubi:tidy-2018-edition, r=Centril
Browse files Browse the repository at this point in the history
Migrate tidy to rust 2018 edition

cc @Centril
  • Loading branch information
Centril authored May 4, 2019
2 parents 68dcca8 + bacf792 commit 10f5a36
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 17 deletions.
1 change: 1 addition & 0 deletions src/tools/tidy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "tidy"
version = "0.1.0"
authors = ["Alex Crichton <[email protected]>"]
edition = "2018"

[dependencies]
regex = "1"
Expand Down
1 change: 1 addition & 0 deletions src/tools/tidy/src/deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::fs;
use std::path::Path;
use std::process::Command;

use serde_derive::Deserialize;
use serde_json;

const LICENSES: &[&str] = &[
Expand Down
2 changes: 1 addition & 1 deletion src/tools/tidy/src/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::path::Path;
use regex::{Regex, escape};

mod version;
use self::version::Version;
use version::Version;

const FEATURE_GROUP_START_PREFIX: &str = "// feature-group-start";
const FEATURE_GROUP_END_PREFIX: &str = "// feature-group-end";
Expand Down
12 changes: 5 additions & 7 deletions src/tools/tidy/src/features/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ impl FromStr for Version {
fn from_str(s: &str) -> Result<Self, Self::Err> {
let mut iter = s.split('.').map(|part| Ok(part.parse()?));

let parts = {
let mut part = || {
iter.next()
.unwrap_or(Err(ParseVersionError::WrongNumberOfParts))
};

[part()?, part()?, part()?]
let mut part = || {
iter.next()
.unwrap_or(Err(ParseVersionError::WrongNumberOfParts))
};

let parts = [part()?, part()?, part()?];

if let Some(_) = iter.next() {
// Ensure we don't have more than 3 parts.
return Err(ParseVersionError::WrongNumberOfParts);
Expand Down
7 changes: 0 additions & 7 deletions src/tools/tidy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
//! This library contains the tidy lints and exposes it
//! to be used by tools.
#![deny(rust_2018_idioms)]

extern crate regex;
extern crate serde_json;
#[macro_use]
extern crate serde_derive;

use std::fs;

use std::path::Path;
Expand Down
2 changes: 0 additions & 2 deletions src/tools/tidy/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
//! etc. This is run by default on `make check` and as part of the auto
//! builders.
#![deny(rust_2018_idioms)]
#![deny(warnings)]

extern crate tidy;
use tidy::*;

use std::process;
Expand Down

0 comments on commit 10f5a36

Please sign in to comment.