mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-29 19:17:12 +00:00
Don't escape 'static
As it is a valid lifetime without escaping. It does need to be escaped as a label, but we have no way to distinguish that.
This commit is contained in:
parent
d781d02cf4
commit
e6ebf0b8a1
2 changed files with 10 additions and 2 deletions
|
|
@ -207,6 +207,14 @@ struct Display<'a> {
|
|||
impl fmt::Display for Display<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut symbol = self.name.symbol.as_str();
|
||||
|
||||
if symbol == "'static" {
|
||||
// FIXME: '`static` can also be a label, and there it does need escaping.
|
||||
// But knowing where it is will require adding a parameter to `display()`,
|
||||
// and that is an infectious change.
|
||||
return f.write_str(symbol);
|
||||
}
|
||||
|
||||
if let Some(s) = symbol.strip_prefix('\'') {
|
||||
f.write_str("'")?;
|
||||
symbol = s;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue