mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
internal: make naming consistent
This commit is contained in:
parent
faa420fc32
commit
6df00f8495
9 changed files with 14 additions and 14 deletions
|
@ -219,7 +219,7 @@ pub enum ArithOp {
|
|||
BitAnd,
|
||||
}
|
||||
|
||||
pub use syntax::ast::PrefixOp as UnaryOp;
|
||||
pub use syntax::ast::UnaryOp;
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub enum Array {
|
||||
ElementList(Vec<ExprId>),
|
||||
|
|
|
@ -126,7 +126,7 @@ pub(super) fn element(
|
|||
let ty = sema.type_of_expr(&expr)?.original;
|
||||
if ty.is_raw_ptr() {
|
||||
HlTag::Operator(HlOperator::Other) | HlMod::Unsafe
|
||||
} else if let Some(ast::PrefixOp::Deref) = prefix_expr.op_kind() {
|
||||
} else if let Some(ast::UnaryOp::Deref) = prefix_expr.op_kind() {
|
||||
HlOperator::Other.into()
|
||||
} else {
|
||||
HlPunct::Other.into()
|
||||
|
|
|
@ -85,7 +85,7 @@ pub(crate) fn apply_demorgan(acc: &mut Assists, ctx: &AssistContext) -> Option<(
|
|||
.and_then(|paren_expr| paren_expr.syntax().parent())
|
||||
.and_then(ast::PrefixExpr::cast)
|
||||
.and_then(|prefix_expr| {
|
||||
if prefix_expr.op_kind().unwrap() == ast::PrefixOp::Not {
|
||||
if prefix_expr.op_kind().unwrap() == ast::UnaryOp::Not {
|
||||
Some(prefix_expr)
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -173,8 +173,8 @@ fn is_equivalent(
|
|||
}
|
||||
}
|
||||
(ast::Expr::PrefixExpr(prefix0), ast::Expr::PrefixExpr(prefix1))
|
||||
if prefix0.op_kind() == Some(ast::PrefixOp::Deref)
|
||||
&& prefix1.op_kind() == Some(ast::PrefixOp::Deref) =>
|
||||
if prefix0.op_kind() == Some(ast::UnaryOp::Deref)
|
||||
&& prefix1.op_kind() == Some(ast::UnaryOp::Deref) =>
|
||||
{
|
||||
cov_mark::hit!(test_pull_assignment_up_deref);
|
||||
if let (Some(prefix0), Some(prefix1)) = (prefix0.expr(), prefix1.expr()) {
|
||||
|
|
|
@ -233,7 +233,7 @@ fn invert_special_case(expr: &ast::Expr) -> Option<ast::Expr> {
|
|||
};
|
||||
Some(make::expr_method_call(receiver, make::name_ref(method), arg_list))
|
||||
}
|
||||
ast::Expr::PrefixExpr(pe) if pe.op_kind()? == ast::PrefixOp::Not => {
|
||||
ast::Expr::PrefixExpr(pe) if pe.op_kind()? == ast::UnaryOp::Not => {
|
||||
if let ast::Expr::ParenExpr(parexpr) = pe.expr()? {
|
||||
parexpr.expr()
|
||||
} else {
|
||||
|
|
|
@ -110,7 +110,7 @@ pub(crate) fn for_variable(expr: &ast::Expr, sema: &Semantics<'_, RootDatabase>)
|
|||
}
|
||||
ast::Expr::ParenExpr(inner) => next_expr = inner.expr(),
|
||||
ast::Expr::TryExpr(inner) => next_expr = inner.expr(),
|
||||
ast::Expr::PrefixExpr(prefix) if prefix.op_kind() == Some(ast::PrefixOp::Deref) => {
|
||||
ast::Expr::PrefixExpr(prefix) if prefix.op_kind() == Some(ast::UnaryOp::Deref) => {
|
||||
next_expr = prefix.expr()
|
||||
}
|
||||
_ => break,
|
||||
|
|
|
@ -24,7 +24,7 @@ pub use self::{
|
|||
AttrKind, AttrsOwnerNode, FieldKind, Macro, NameLike, NameOrNameRef, PathSegmentKind,
|
||||
SelfParamKind, SlicePatComponents, StructKind, TypeBoundKind, VisibilityKind,
|
||||
},
|
||||
operators::{PrefixOp, RangeOp},
|
||||
operators::{RangeOp, UnaryOp},
|
||||
token_ext::{
|
||||
CommentKind, CommentPlacement, CommentShape, HasFormatSpecifier, IsString, QuoteOffsets,
|
||||
Radix,
|
||||
|
|
|
@ -5,7 +5,7 @@ use rowan::WalkEvent;
|
|||
use crate::{
|
||||
ast::{
|
||||
self,
|
||||
operators::{PrefixOp, RangeOp},
|
||||
operators::{RangeOp, UnaryOp},
|
||||
support, AstChildren, AstNode,
|
||||
},
|
||||
AstToken,
|
||||
|
@ -198,11 +198,11 @@ impl ast::IfExpr {
|
|||
}
|
||||
|
||||
impl ast::PrefixExpr {
|
||||
pub fn op_kind(&self) -> Option<PrefixOp> {
|
||||
pub fn op_kind(&self) -> Option<UnaryOp> {
|
||||
let res = match self.op_token()?.kind() {
|
||||
T![*] => PrefixOp::Deref,
|
||||
T![!] => PrefixOp::Not,
|
||||
T![-] => PrefixOp::Neg,
|
||||
T![*] => UnaryOp::Deref,
|
||||
T![!] => UnaryOp::Not,
|
||||
T![-] => UnaryOp::Neg,
|
||||
_ => return None,
|
||||
};
|
||||
Some(res)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
|
||||
pub enum PrefixOp {
|
||||
pub enum UnaryOp {
|
||||
/// The `*` operator for dereferencing
|
||||
Deref,
|
||||
/// The `!` operator for logical inversion
|
||||
|
|
Loading…
Reference in a new issue