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 the correct crate name (as in crates.io) to toml and notify user #98

Merged
merged 1 commit into from
Jan 3, 2017

Conversation

sinkuu
Copy link

@sinkuu sinkuu commented Jan 1, 2017

Resurrecting #78

Copy link
Owner

@killercup killercup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think this is the expected behavior of cargo-add. I have not tried this locally and only read the code. Can you add integration tests for this?

.ok_or(FetchVersionError::CratesIo(CratesIoError::NotFound)));

if name != crate_name {
println!("WARN: Added {} instead of {}", name, crate_name);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good reminder to add an actual logging facility some time soon (but not in this PR) :)

let v = format!("{prefix}{version}",
prefix = self.get_upgrade_prefix().unwrap_or(""),
version = try!(get_latest_version(&self.arg_crate)));
dependency.set_version(&v)
version = dep.version().unwrap_or_else(|| unreachable!()));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment why you are sure this is actually always present and unreachable is fine here?

use std::path::Path;
use rustc_serialize::json;
use rustc_serialize::json::{BuilderError, Json};

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove leading empty line

@sinkuu
Copy link
Author

sinkuu commented Jan 2, 2017

Done.

@killercup
Copy link
Owner

Thanks for the quick reply! Since this will conflict with the changes made in #99 and #100 I'll merge this locally and make a new PR that contains the commits of three PRs. (Once the new PR is merged, this one will automatically be marked as merged.)

@killercup killercup mentioned this pull request Jan 2, 2017
@homu homu merged commit 9c31b4d into killercup:master Jan 3, 2017
homu added a commit that referenced this pull request Jan 3, 2017
…rcup

New year, new bugfixes

This is a rollup of #98 (which replaces #78), #99, and #100.

@sebasgarcep and @sinkuu, thank you for your PRs! Do you have time to review this? I've add a few tests and changed to code slightly, before running Rustfmt and Clippy.

Just to make sure Github gets all the references:

Fixes #52
Fixes #88
Fixes #92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants