Skip to content

Commit

Permalink
Rename BinOpKind::lazy as BinOpKind::is_lazy.
Browse files Browse the repository at this point in the history
To match `BinOpKind::is_comparison` and `hir::BinOpKind::is_lazy`.
  • Loading branch information
nnethercote committed Nov 27, 2023
1 parent 0efd2a9 commit 705b484
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,8 @@ impl BinOpKind {
Gt => ">",
}
}
pub fn lazy(&self) -> bool {

pub fn is_lazy(&self) -> bool {
matches!(self, BinOpKind::And | BinOpKind::Or)
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_lint/src/unused.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ trait UnusedDelimLint {
) -> bool {
if followed_by_else {
match inner.kind {
ast::ExprKind::Binary(op, ..) if op.node.lazy() => return true,
ast::ExprKind::Binary(op, ..) if op.node.is_lazy() => return true,
_ if classify::expr_trailing_brace(inner).is_some() => return true,
_ => {}
}
Expand Down Expand Up @@ -1016,7 +1016,7 @@ impl UnusedDelimLint for UnusedParens {
rustc_span::source_map::Spanned { node, .. },
_,
_,
) if node.lazy()))
) if node.is_lazy()))
{
self.emit_unused_delims_expr(cx, value, ctx, left_pos, right_pos, is_kw)
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/parser/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ impl<'a> Parser<'a> {

fn check_let_else_init_bool_expr(&self, init: &ast::Expr) {
if let ast::ExprKind::Binary(op, ..) = init.kind {
if op.node.lazy() {
if op.node.is_lazy() {
self.sess.emit_err(errors::InvalidExpressionInLetElse {
span: init.span,
operator: op.node.as_str(),
Expand Down

0 comments on commit 705b484

Please sign in to comment.