Skip to content

Commit 058e2d2

Browse files
committed
Auto merge of #14925 - viktorlott:inline-const-expr-as-static-str, r=HKalbasi
feat: inline const as literal Assist: inline_const_as_literal Evaluate and inline const variable as literal. ```rust const STRING: &str = "Hello, World!"; fn something() -> &'static str { STR$0ING } ``` -> ```rust const STRING: &str = "Hello, World!"; fn something() -> &'static str { "Hello, World!" } ```
2 parents f3145dc + eef716d commit 058e2d2

File tree

5 files changed

+754
-2
lines changed

5 files changed

+754
-2
lines changed

crates/hir/src/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3494,6 +3494,14 @@ impl Type {
34943494
}
34953495
}
34963496

3497+
pub fn is_scalar(&self) -> bool {
3498+
matches!(self.ty.kind(Interner), TyKind::Scalar(_))
3499+
}
3500+
3501+
pub fn is_tuple(&self) -> bool {
3502+
matches!(self.ty.kind(Interner), TyKind::Tuple(..))
3503+
}
3504+
34973505
pub fn remove_ref(&self) -> Option<Type> {
34983506
match &self.ty.kind(Interner) {
34993507
TyKind::Ref(.., ty) => Some(self.derived(ty.clone())),

0 commit comments

Comments
 (0)