Skip to content

Migrate tidy to rust 2018 edition #60521

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

Merged
merged 2 commits into from
May 4, 2019
Merged
Changes from 1 commit
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
Prev Previous commit
tidy: Extract let mut part out of parts block in version.rs
  • Loading branch information
rasendubi committed May 3, 2019
commit bacf792f6f8b3ae2e94930eb11faeaa49f081549
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