mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Auto merge of #15169 - lowr:patch/impl-header-anon-lifetime, r=HKalbasi
Use anonymous lifetime where possible Because anonymous lifetimes are *super* cool. More seriously, I believe anonymous lifetimes, especially those in impl headers, reduce cognitive load to a certain extent because they usually signify that they are not relevant in the signature of the methods within (or that we can apply the usual lifetime elision rules even if they are relevant).
This commit is contained in:
commit
76bcd9946a
30 changed files with 60 additions and 60 deletions
|
@ -105,7 +105,7 @@ struct Printer<'a> {
|
|||
needs_indent: bool,
|
||||
}
|
||||
|
||||
impl<'a> Write for Printer<'a> {
|
||||
impl Write for Printer<'_> {
|
||||
fn write_str(&mut self, s: &str) -> fmt::Result {
|
||||
for line in s.split_inclusive('\n') {
|
||||
if self.needs_indent {
|
||||
|
@ -125,7 +125,7 @@ impl<'a> Write for Printer<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Printer<'a> {
|
||||
impl Printer<'_> {
|
||||
fn indented(&mut self, f: impl FnOnce(&mut Self)) {
|
||||
self.indent_level += 1;
|
||||
wln!(self);
|
||||
|
|
|
@ -52,7 +52,7 @@ struct Printer<'a> {
|
|||
needs_indent: bool,
|
||||
}
|
||||
|
||||
impl<'a> Printer<'a> {
|
||||
impl Printer<'_> {
|
||||
fn indented(&mut self, f: impl FnOnce(&mut Self)) {
|
||||
self.indent_level += 1;
|
||||
wln!(self);
|
||||
|
@ -572,7 +572,7 @@ impl<'a> Printer<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Write for Printer<'a> {
|
||||
impl Write for Printer<'_> {
|
||||
fn write_str(&mut self, s: &str) -> fmt::Result {
|
||||
for line in s.split_inclusive('\n') {
|
||||
if self.needs_indent {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue