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

Add "Parse a complex version string" example #308

Merged
merged 1 commit into from Oct 4, 2017

Conversation

Projects
None yet
2 participants
@FaultyRAM
Copy link
Contributor

FaultyRAM commented Oct 1, 2017

Fixes #284

@FaultyRAM FaultyRAM changed the title Parse a complex version string. Add "Parse a complex version string" example Oct 1, 2017

@budziq
Copy link
Collaborator

budziq left a comment

@FaultyRAM very nice! I would suggest 2 minor stylistic adjustments and we are good to merge 👍

src/app.md Outdated
let version_str = "1.0.49-125+g72ee7853";
let version = Version::parse(version_str)?;
assert_eq!(version.major, 1);

This comment has been minimized.

@budziq

budziq Oct 1, 2017

Collaborator

I would suggest to group these assert_eq's into a single one like in the more basic "Parse and increment a version string" example for the sake of consistency.

src/app.md Outdated
Identifier::AlphaNumeric(String::from("g72ee7853"))
);
let version_string = version.to_string();

This comment has been minimized.

@budziq

budziq Oct 1, 2017

Collaborator

i would rename the variable to serialized_version or something along these lines to emphasize what is going on here.

@budziq
Copy link
Collaborator

budziq left a comment

Awesome! Please see to the last nit, squash the commits and we are ready to merge :)

src/app.md Outdated
);
let parsed_version = Version::parse(version_str)?;
let constructed_version = Version {

This comment has been minimized.

@budziq

budziq Oct 2, 2017

Collaborator

lets drop the intermediate variable and create it directly in the assert_eq

src/app.md Outdated
build: vec![],
};
assert_eq!(parsed_version, constructed_version);

This comment has been minimized.

@budziq

budziq Oct 2, 2017

Collaborator

lets reintroduce the separate assert_eq with just the build metadata to show that it is in fact parsed.

@FaultyRAM FaultyRAM force-pushed the FaultyRAM:ex-semver-complex branch from 3ccef37 to e913739 Oct 3, 2017

@budziq budziq merged commit b7ab129 into rust-lang-nursery:master Oct 4, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@budziq

This comment has been minimized.

Copy link
Collaborator

budziq commented Oct 4, 2017

Nicely done @FaultyRAM !

@FaultyRAM FaultyRAM deleted the FaultyRAM:ex-semver-complex branch Oct 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.