Skip to content

Rustfmt everything #234

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

Closed
wants to merge 5 commits into from
Closed

Conversation

vimpunk
Copy link
Contributor

@vimpunk vimpunk commented Nov 19, 2018

I was reading through the code and noticed that the formatting was different from what I understand to be the currently agreed upon convention. So I ran rustfmt on the entire repo. I hope that's welcome. Tests run as previously.


This change is Reviewable

@vimpunk vimpunk changed the title Rustftm everything Rustfmt everything Nov 19, 2018
@CYBAI
Copy link
Member

CYBAI commented Nov 20, 2018

r? @emilio

@vimpunk
Copy link
Contributor Author

vimpunk commented Nov 20, 2018

Initially I hadn't noticed that Servo had custom settings for the formatter, so I added the config file and rerun rustfmt. Probably needs squashing.

}
}
}
($proc_macro_name: ident ! $paren: tt) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is the extreme indentation of this macro definition as expected?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, this looks wrong. Maybe revert it and file a rustfmt issue?

Ident |
Function |
UrlOrBadUrl |
DelimMinus |
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This also seems a little strange to me.

Copy link
Member

@emilio emilio left a comment

Choose a reason for hiding this comment

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

Looks ok to me modulo that macro. That seems like a weird rustfmt bug, since running rustfmt again with it ends up indenting it further.

In any case I think @SimonSapin should have the last word on this PR :)

}
}
}
($proc_macro_name: ident ! $paren: tt) => {
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, this looks wrong. Maybe revert it and file a rustfmt issue?

Some(protocol_encoding) => return protocol_encoding
}
Some(protocol_encoding) => return protocol_encoding,
},
}
let prefix = b"@charset \"";
if css.starts_with(prefix) {
let rest = &css[prefix.len()..];
match rest.iter().position(|&b| b == b'"') {
None => (),
Copy link
Member

Choose a reason for hiding this comment

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

This could use if let.

src/parser.rs Outdated
Err(e) => unreachable!("Unexpected error encountered: {:?}", e),
Ok(t) => Err(start.source_location().new_basic_unexpected_token_error(t.clone())),
Ok(t) => Err(start
Copy link
Member

Choose a reason for hiding this comment

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

This does look a bit weird as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, that's weird indeed. Putting them back on a single line fits under the line width limit too, so I'm not sure why this was formatted. Maybe another bug?
I'll file an issue for the macro bug (couldn't reply to that one for some reason).

@emilio
Copy link
Member

emilio commented Nov 20, 2018

r? @SimonSapin

@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #238) made this pull request unmergeable. Please resolve the merge conflicts.

@SimonSapin
Copy link
Member

Thanks!

I’ve rebased and integrated this in #245. I removed the rustfmt.toml file since it’s more important IMO to be able to run stable rustfmt (and get formatting consistent with running it on Nightly) than to have the same style as servo/servo.

@SimonSapin SimonSapin closed this Apr 24, 2019
@vimpunk vimpunk deleted the rustfmt-everything branch April 25, 2019 13:01
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.

5 participants