Skip to content

Commit 6df00f8

Browse files
committed
internal: make naming consistent
1 parent faa420f commit 6df00f8

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

crates/hir_def/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ pub enum ArithOp {
219219
BitAnd,
220220
}
221221

222-
pub use syntax::ast::PrefixOp as UnaryOp;
222+
pub use syntax::ast::UnaryOp;
223223
#[derive(Debug, Clone, Eq, PartialEq)]
224224
pub enum Array {
225225
ElementList(Vec<ExprId>),

crates/ide/src/syntax_highlighting/highlight.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub(super) fn element(
126126
let ty = sema.type_of_expr(&expr)?.original;
127127
if ty.is_raw_ptr() {
128128
HlTag::Operator(HlOperator::Other) | HlMod::Unsafe
129-
} else if let Some(ast::PrefixOp::Deref) = prefix_expr.op_kind() {
129+
} else if let Some(ast::UnaryOp::Deref) = prefix_expr.op_kind() {
130130
HlOperator::Other.into()
131131
} else {
132132
HlPunct::Other.into()

crates/ide_assists/src/handlers/apply_demorgan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub(crate) fn apply_demorgan(acc: &mut Assists, ctx: &AssistContext) -> Option<(
8585
.and_then(|paren_expr| paren_expr.syntax().parent())
8686
.and_then(ast::PrefixExpr::cast)
8787
.and_then(|prefix_expr| {
88-
if prefix_expr.op_kind().unwrap() == ast::PrefixOp::Not {
88+
if prefix_expr.op_kind().unwrap() == ast::UnaryOp::Not {
8989
Some(prefix_expr)
9090
} else {
9191
None

crates/ide_assists/src/handlers/pull_assignment_up.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ fn is_equivalent(
173173
}
174174
}
175175
(ast::Expr::PrefixExpr(prefix0), ast::Expr::PrefixExpr(prefix1))
176-
if prefix0.op_kind() == Some(ast::PrefixOp::Deref)
177-
&& prefix1.op_kind() == Some(ast::PrefixOp::Deref) =>
176+
if prefix0.op_kind() == Some(ast::UnaryOp::Deref)
177+
&& prefix1.op_kind() == Some(ast::UnaryOp::Deref) =>
178178
{
179179
cov_mark::hit!(test_pull_assignment_up_deref);
180180
if let (Some(prefix0), Some(prefix1)) = (prefix0.expr(), prefix1.expr()) {

crates/ide_assists/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ fn invert_special_case(expr: &ast::Expr) -> Option<ast::Expr> {
233233
};
234234
Some(make::expr_method_call(receiver, make::name_ref(method), arg_list))
235235
}
236-
ast::Expr::PrefixExpr(pe) if pe.op_kind()? == ast::PrefixOp::Not => {
236+
ast::Expr::PrefixExpr(pe) if pe.op_kind()? == ast::UnaryOp::Not => {
237237
if let ast::Expr::ParenExpr(parexpr) = pe.expr()? {
238238
parexpr.expr()
239239
} else {

crates/ide_assists/src/utils/suggest_name.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub(crate) fn for_variable(expr: &ast::Expr, sema: &Semantics<'_, RootDatabase>)
110110
}
111111
ast::Expr::ParenExpr(inner) => next_expr = inner.expr(),
112112
ast::Expr::TryExpr(inner) => next_expr = inner.expr(),
113-
ast::Expr::PrefixExpr(prefix) if prefix.op_kind() == Some(ast::PrefixOp::Deref) => {
113+
ast::Expr::PrefixExpr(prefix) if prefix.op_kind() == Some(ast::UnaryOp::Deref) => {
114114
next_expr = prefix.expr()
115115
}
116116
_ => break,

crates/syntax/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub use self::{
2424
AttrKind, AttrsOwnerNode, FieldKind, Macro, NameLike, NameOrNameRef, PathSegmentKind,
2525
SelfParamKind, SlicePatComponents, StructKind, TypeBoundKind, VisibilityKind,
2626
},
27-
operators::{PrefixOp, RangeOp},
27+
operators::{RangeOp, UnaryOp},
2828
token_ext::{
2929
CommentKind, CommentPlacement, CommentShape, HasFormatSpecifier, IsString, QuoteOffsets,
3030
Radix,

crates/syntax/src/ast/expr_ext.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rowan::WalkEvent;
55
use crate::{
66
ast::{
77
self,
8-
operators::{PrefixOp, RangeOp},
8+
operators::{RangeOp, UnaryOp},
99
support, AstChildren, AstNode,
1010
},
1111
AstToken,
@@ -198,11 +198,11 @@ impl ast::IfExpr {
198198
}
199199

200200
impl ast::PrefixExpr {
201-
pub fn op_kind(&self) -> Option<PrefixOp> {
201+
pub fn op_kind(&self) -> Option<UnaryOp> {
202202
let res = match self.op_token()?.kind() {
203-
T![*] => PrefixOp::Deref,
204-
T![!] => PrefixOp::Not,
205-
T![-] => PrefixOp::Neg,
203+
T![*] => UnaryOp::Deref,
204+
T![!] => UnaryOp::Not,
205+
T![-] => UnaryOp::Neg,
206206
_ => return None,
207207
};
208208
Some(res)

crates/syntax/src/ast/operators.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
2-
pub enum PrefixOp {
2+
pub enum UnaryOp {
33
/// The `*` operator for dereferencing
44
Deref,
55
/// The `!` operator for logical inversion

0 commit comments

Comments
 (0)