mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Merge #1194
1194: Pr 1190 r=matklad a=matklad Co-authored-by: Andrea Pretto <eulerdisk@gmail.com> Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
c416caeda2
7 changed files with 272 additions and 78 deletions
|
@ -46,6 +46,19 @@ impl Name {
|
|||
Name::new(idx.to_string().into())
|
||||
}
|
||||
|
||||
// There's should be no way to extract a string out of `Name`: `Name` in the
|
||||
// future, `Name` will include hygiene information, and you can't encode
|
||||
// hygiene into a String.
|
||||
//
|
||||
// If you need to compare something with `Name`, compare `Name`s directly.
|
||||
//
|
||||
// If you need to render `Name` for the user, use the `Display` impl, but be
|
||||
// aware that it strips hygiene info.
|
||||
#[deprecated(note = "use to_string instead")]
|
||||
pub fn as_smolstr(&self) -> &SmolStr {
|
||||
&self.text
|
||||
}
|
||||
|
||||
pub(crate) fn as_known_name(&self) -> Option<KnownName> {
|
||||
let name = match self.text.as_str() {
|
||||
"isize" => KnownName::Isize,
|
||||
|
|
|
@ -21,7 +21,7 @@ use crate::{
|
|||
AsName, Module, HirFileId, Crate, Trait, Resolver, Ty,
|
||||
expr::{BodySourceMap, scope::{ScopeId, ExprScopes}},
|
||||
ids::LocationCtx,
|
||||
expr, AstId
|
||||
expr, AstId,
|
||||
};
|
||||
|
||||
/// Locates the module by `FileId`. Picks topmost module in the file.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue