Skip to content

Commit e01ff77

Browse files
jhggVeykril
andauthored
Apply suggestions from code review
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
1 parent 28b6a30 commit e01ff77

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

crates/hir/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,7 +1842,7 @@ impl Local {
18421842

18431843
pub fn is_ref(self, db: &dyn HirDatabase) -> bool {
18441844
let body = db.body(self.parent);
1845-
matches!(&body[self.pat_id], Pat::Bind { mode: BindingAnnotation::Ref, .. })
1845+
matches!(&body[self.pat_id], Pat::Bind { mode: BindingAnnotation::Ref | BindingAnnotation::RefMut, .. })
18461846
}
18471847

18481848
pub fn parent(self, _db: &dyn HirDatabase) -> DefWithBody {
@@ -2201,7 +2201,7 @@ impl Type {
22012201
}
22022202

22032203
pub fn is_reference(&self) -> bool {
2204-
matches!(self.ty.kind(&Interner), TyKind::Ref(hir_ty::Mutability::Not, ..))
2204+
matches!(self.ty.kind(&Interner), TyKind::Ref(..))
22052205
}
22062206

22072207
pub fn is_usize(&self) -> bool {

crates/ide/src/syntax_highlighting/highlight.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ fn highlight_def(db: &RootDatabase, krate: Option<hir::Crate>, def: Definition)
376376
h |= HlMod::Associated;
377377
match func.self_param(db) {
378378
Some(sp) => match sp.access(db) {
379-
hir::Access::Exclusive => h |= HlMod::Mutable,
379+
hir::Access::Exclusive => h = h | HlMod::Mutable | HlMod::Reference,
380380
hir::Access::Shared => h |= HlMod::Reference,
381381
_ => {}
382382
},
@@ -555,7 +555,7 @@ fn highlight_method_call(
555555
if let Some(self_param) = func.self_param(sema.db) {
556556
match self_param.access(sema.db) {
557557
hir::Access::Shared => h |= HlMod::Reference,
558-
hir::Access::Exclusive => h |= HlMod::Mutable,
558+
hir::Access::Exclusive => h | HlMod::Mutable | HlMod::Reference,
559559
hir::Access::Owned => {
560560
if let Some(receiver_ty) =
561561
method_call.receiver().and_then(|it| sema.type_of_expr(&it))

0 commit comments

Comments
 (0)