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

Implemented support for workspaces #1413

Merged
merged 1 commit into from
Mar 30, 2017
Merged

Implemented support for workspaces #1413

merged 1 commit into from
Mar 30, 2017

Conversation

Emilgardis
Copy link
Contributor

see #1244
cc @nrc

@Emilgardis
Copy link
Contributor Author

Emilgardis commented Mar 27, 2017

I believe I have fixed the errors the tests gave me.

Copy link
Member

@nrc nrc left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I think this is good. I have a few comments inline where the code could be polished. I'd also like to get someone more familiar with Cargo to review this too

}
}

fn is_none(&self) -> bool {
Copy link
Member

Choose a reason for hiding this comment

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

If you derive Eq and ParitalEq then you could use == rather than needing the is_all and _none methods


pub fn get_some<'a>(&'a self) -> Option<&'a [String]> {
use std::borrow::Borrow;
match self {
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to use if let rather than match here

pub fn get_some<'a>(&'a self) -> Option<&'a [String]> {
use std::borrow::Borrow;
match self {
&WorkspaceHitlist::Some(ref hitlist) => Some(hitlist.borrow()),
Copy link
Member

Choose a reason for hiding this comment

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

You should be able to use &hitlist (or possibly &*hitlist if that doesn't work) rather than borrow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes not sure why I forgot about the deref on vecs

@@ -63,7 +70,13 @@ fn execute() -> i32 {
return success;
}

match format_crate(verbosity) {
let workspace_hitlist = match (matches.opt_present("all"), matches.opt_present("p")) {
Copy link
Member

Choose a reason for hiding this comment

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

I would factor this out into WorkspaceHitlist::from_matches

.unwrap()
.as_string()
.unwrap();
if hitlist.take(&member_name.to_string()).is_some() {
Copy link
Member

Choose a reason for hiding this comment

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

You can remove the if block here and just return hitlist.take(&member_name.to_string()).is_some()

@Emilgardis
Copy link
Contributor Author

I've addressed your comments @nrc and also changed the error message for -p <package> inside a non workshop environment

@nrc
Copy link
Member

nrc commented Mar 29, 2017

@Emilgardis thanks for the changes. Could you rebase please? Then I will merge.

@Emilgardis
Copy link
Contributor Author

Test errors are unrelated to my changes as far as I can see.

@Emilgardis
Copy link
Contributor Author

Is this possibly a regression in nightly?

@nrc nrc merged commit 3edc184 into rust-lang:master Mar 30, 2017
@nrc
Copy link
Member

nrc commented Mar 30, 2017

Yeah, the doctest behaviour in nightly changed. I fixed this for rustfmt in a commit last night

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.

2 participants