Skip to content

sync subtree #5276

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
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "nightly-2022-03-17"
channel = "nightly-2022-03-27"
components = ["rustc-dev"]
2 changes: 1 addition & 1 deletion src/lists.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ where
pub(crate) fn extract_pre_comment(pre_snippet: &str) -> (Option<String>, ListItemCommentStyle) {
let trimmed_pre_snippet = pre_snippet.trim();
// Both start and end are checked to support keeping a block comment inline with
// the item, even if there are preceeding line comments, while still supporting
// the item, even if there are preceding line comments, while still supporting
// a snippet that starts with a block comment but also contains one or more
// trailing single line comments.
// https://github.com/rust-lang/rustfmt/issues/3025
Expand Down
2 changes: 1 addition & 1 deletion src/parse/macros/lazy_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub(crate) fn parse_lazy_static(
($method:ident $(,)* $($arg:expr),* $(,)*) => {
match parser.$method($($arg,)*) {
Ok(val) => {
if parser.sess.span_diagnostic.has_errors() {
if parser.sess.span_diagnostic.has_errors().is_some() {
parser.sess.span_diagnostic.reset_err_count();
return None;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/parse/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn parse_macro_arg<'a, 'b: 'a>(parser: &'a mut Parser<'b>) -> Option<MacroArg> {
let mut cloned_parser = (*parser).clone();
match $parser(&mut cloned_parser) {
Ok(x) => {
if parser.sess.span_diagnostic.has_errors() {
if parser.sess.span_diagnostic.has_errors().is_some() {
parser.sess.span_diagnostic.reset_err_count();
} else {
// Parsing succeeded.
Expand Down
8 changes: 5 additions & 3 deletions src/parse/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,10 @@ impl ParseSess {
// Methods that should be restricted within the parse module.
impl ParseSess {
pub(super) fn emit_diagnostics(&self, diagnostics: Vec<Diagnostic>) {
for diagnostic in diagnostics {
self.parse_sess.span_diagnostic.emit_diagnostic(&diagnostic);
for mut diagnostic in diagnostics {
self.parse_sess
.span_diagnostic
.emit_diagnostic(&mut diagnostic);
}
}

Expand All @@ -265,7 +267,7 @@ impl ParseSess {
}

pub(super) fn has_errors(&self) -> bool {
self.parse_sess.span_diagnostic.has_errors()
self.parse_sess.span_diagnostic.has_errors().is_some()
}

pub(super) fn reset_errors(&self) {
Expand Down
2 changes: 1 addition & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ fn rewrite_segment(
match **args {
ast::GenericArgs::AngleBracketed(ref data) if !data.args.is_empty() => {
// HACK: squeeze out the span between the identifier and the parameters.
// The hack is requried so that we don't remove the separator inside macro calls.
// The hack is required so that we don't remove the separator inside macro calls.
// This does not work in the presence of comment, hoping that people are
// sane about where to put their comment.
let separator_snippet = context
Expand Down