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

Migrate tidy to rust 2018 edition #60521

Merged
merged 2 commits into from
May 4, 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 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 <alex@alexcrichton.com>"]
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