Rollup merge of #60521 - rasendubi:tidy-2018-edition, r=Centril

Migrate tidy to rust 2018 edition

cc @Centril
This commit is contained in:
Mazdak Farrokhzad 2019-05-04 09:21:32 +02:00 committed by GitHub
commit 10f5a36664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 17 deletions

View File

@ -2,6 +2,7 @@
name = "tidy"
version = "0.1.0"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
edition = "2018"
[dependencies]
regex = "1"

View File

@ -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] = &[

View File

@ -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";

View File

@ -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);

View File

@ -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;

View File

@ -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;