🚨 Remove explicit lifetimes where they could be elided

This commit is contained in:
Dima Pristupa 2021-10-25 19:33:33 +03:00 committed by Taiki Endo
parent bd3b893818
commit f19a241d7d
1 changed files with 9 additions and 9 deletions

View File

@ -350,17 +350,17 @@ impl Test {
}
}
fn init<'a>(self: Pin<&'a mut Self>) {
fn init(self: Pin<mut Self>) {
let self_ptr: *const String = &self.a;
let this = unsafe { self.get_unchecked_mut() };
this.b = self_ptr;
}
fn a<'a>(self: Pin<&'a Self>) -> &'a str {
fn a(self: Pin<&Self>) -> &str {
&self.get_ref().a
}
fn b<'a>(self: Pin<&'a Self>) -> &'a String {
fn b(self: Pin<&Self>) -> &String {
assert!(!self.b.is_null(), "Test::b called without Test::init being called first");
unsafe { &*(self.b) }
}
@ -409,17 +409,17 @@ pub fn main() {
# }
# }
#
# fn init<'a>(self: Pin<&'a mut Self>) {
# fn init(self: Pin<&mut Self>) {
# let self_ptr: *const String = &self.a;
# let this = unsafe { self.get_unchecked_mut() };
# this.b = self_ptr;
# }
#
# fn a<'a>(self: Pin<&'a Self>) -> &'a str {
# fn a(self: Pin<&Self>) -> &str {
# &self.get_ref().a
# }
#
# fn b<'a>(self: Pin<&'a Self>) -> &'a String {
# fn b(self: Pin<&Self>) -> &String {
# assert!(!self.b.is_null(), "Test::b called without Test::init being called first");
# unsafe { &*(self.b) }
# }
@ -462,17 +462,17 @@ pub fn main() {
# }
# }
#
# fn init<'a>(self: Pin<&'a mut Self>) {
# fn init(self: Pin<&mut Self>) {
# let self_ptr: *const String = &self.a;
# let this = unsafe { self.get_unchecked_mut() };
# this.b = self_ptr;
# }
#
# fn a<'a>(self: Pin<&'a Self>) -> &'a str {
# fn a(self: Pin<&Self>) -> &str {
# &self.get_ref().a
# }
#
# fn b<'a>(self: Pin<&'a Self>) -> &'a String {
# fn b(self: Pin<&Self>) -> &String {
# assert!(!self.b.is_null(), "Test::b called without Test::init being called first");
# unsafe { &*(self.b) }
# }