Skip to content

Commit 4fd00fb

Browse files
committed
remove explicit lifetimes where they can be elided
1 parent 4083728 commit 4fd00fb

File tree

10 files changed

+32
-32
lines changed

10 files changed

+32
-32
lines changed

capnp-futures/src/serialize.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,18 +139,18 @@ fn parse_segment_table_first(buf: &[u8]) -> Result<(usize, usize)>
139139

140140
/// Something that contains segments ready to be written out.
141141
pub trait AsOutputSegments {
142-
fn as_output_segments<'a>(&'a self) -> OutputSegments<'a>;
142+
fn as_output_segments(&self) -> OutputSegments;
143143
}
144144

145145

146146
impl <'a, M> AsOutputSegments for &'a M where M: AsOutputSegments {
147-
fn as_output_segments<'b>(&'b self) -> OutputSegments<'b> {
147+
fn as_output_segments(&self) -> OutputSegments {
148148
(*self).as_output_segments()
149149
}
150150
}
151151

152152
impl <A> AsOutputSegments for message::Builder<A> where A: message::Allocator {
153-
fn as_output_segments<'a>(&'a self) -> OutputSegments<'a> {
153+
fn as_output_segments(&self) -> OutputSegments {
154154
self.get_segments_for_output()
155155
}
156156
}
@@ -162,7 +162,7 @@ impl <A> AsOutputSegments for message::Builder<A> where A: message::Allocator {
162162
}*/
163163

164164
impl <A> AsOutputSegments for ::std::rc::Rc<message::Builder<A>> where A: message::Allocator {
165-
fn as_output_segments<'a>(&'a self) -> OutputSegments<'a> {
165+
fn as_output_segments(&self) -> OutputSegments {
166166
self.get_segments_for_output()
167167
}
168168
}
@@ -394,7 +394,7 @@ pub mod test {
394394
}
395395

396396
impl AsOutputSegments for Vec<Vec<capnp::Word>> {
397-
fn as_output_segments<'a>(&'a self) -> OutputSegments<'a> {
397+
fn as_output_segments(&self) -> OutputSegments {
398398
if self.is_empty() {
399399
OutputSegments::SingleSegment([&[]])
400400
} else if self.len() == 1 {

capnp-rpc/src/broken.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ impl Request {
6565
}
6666

6767
impl RequestHook for Request {
68-
fn get<'a>(&'a mut self) -> any_pointer::Builder<'a> {
68+
fn get(&mut self) -> any_pointer::Builder {
6969
let mut result: any_pointer::Builder = self.message.get_root().unwrap();
7070
result.imbue_mut(&mut self.cap_table);
7171
result

capnp-rpc/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ mod task_set;
106106
pub mod twoparty;
107107

108108
pub trait OutgoingMessage {
109-
fn get_body<'a>(&'a mut self) -> ::capnp::Result<::capnp::any_pointer::Builder<'a>>;
110-
fn get_body_as_reader<'a>(&'a self) -> ::capnp::Result<::capnp::any_pointer::Reader<'a>>;
109+
fn get_body(&mut self) -> ::capnp::Result<::capnp::any_pointer::Builder>;
110+
fn get_body_as_reader(&self) -> ::capnp::Result<::capnp::any_pointer::Reader>;
111111

112112
/// Sends the message. Returns a promise for the message that resolves once the send has completed.
113113
/// Dropping the returned promise does *not* cancel the send.
@@ -119,7 +119,7 @@ pub trait OutgoingMessage {
119119
}
120120

121121
pub trait IncomingMessage {
122-
fn get_body<'a>(&'a self) -> ::capnp::Result<::capnp::any_pointer::Reader<'a>>;
122+
fn get_body(&self) -> ::capnp::Result<::capnp::any_pointer::Reader>;
123123
}
124124

125125
pub trait Connection<VatId> {

capnp-rpc/src/local.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use std::mem;
3434

3535
pub trait ResultsDoneHook {
3636
fn add_ref(&self) -> Box<dyn ResultsDoneHook>;
37-
fn get<'a>(&'a self) -> ::capnp::Result<any_pointer::Reader<'a>>;
37+
fn get(&self) -> ::capnp::Result<any_pointer::Reader>;
3838
}
3939

4040
impl Clone for Box<dyn ResultsDoneHook> {
@@ -56,7 +56,7 @@ impl Response {
5656
}
5757

5858
impl ResponseHook for Response {
59-
fn get<'a>(&'a self) -> ::capnp::Result<any_pointer::Reader<'a>> {
59+
fn get(&self) -> ::capnp::Result<any_pointer::Reader> {
6060
self.results.get()
6161
}
6262
}
@@ -79,7 +79,7 @@ impl Params {
7979
}
8080

8181
impl ParamsHook for Params {
82-
fn get<'a>(&'a self) -> ::capnp::Result<any_pointer::Reader<'a>> {
82+
fn get(&self) -> ::capnp::Result<any_pointer::Reader> {
8383
let mut result: any_pointer::Reader = self.request.get_root_as_reader()?;
8484
result.imbue(&self.cap_table);
8585
Ok(result)
@@ -114,7 +114,7 @@ impl Drop for Results {
114114
}
115115

116116
impl ResultsHook for Results {
117-
fn get<'a>(&'a mut self) -> ::capnp::Result<any_pointer::Builder<'a>> {
117+
fn get(&mut self) -> ::capnp::Result<any_pointer::Builder> {
118118
match *self {
119119
Results { message: Some(ref mut message), ref mut cap_table, .. } => {
120120
let mut result: any_pointer::Builder = message.get_root()?;
@@ -168,7 +168,7 @@ impl ResultsDoneHook for ResultsDone {
168168
fn add_ref(&self) -> Box<dyn ResultsDoneHook> {
169169
Box::new(ResultsDone { inner: self.inner.clone() })
170170
}
171-
fn get<'a>(&'a self) -> ::capnp::Result<any_pointer::Reader<'a>> {
171+
fn get(&self) -> ::capnp::Result<any_pointer::Reader> {
172172
let mut result: any_pointer::Reader = self.inner.message.get_root_as_reader()?;
173173
result.imbue(&self.inner.cap_table);
174174
Ok(result)
@@ -201,7 +201,7 @@ impl Request {
201201
}
202202

203203
impl RequestHook for Request {
204-
fn get<'a>(&'a mut self) -> any_pointer::Builder<'a> {
204+
fn get(&mut self) -> any_pointer::Builder {
205205
let mut result: any_pointer::Builder = self.message.get_root().unwrap();
206206
result.imbue_mut(&mut self.cap_table);
207207
result

capnp-rpc/src/rpc.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl <T> ExportTable<T> {
127127
}
128128
}
129129

130-
pub fn find<'a>(&'a mut self, id: u32) -> Option<&'a mut T> {
130+
pub fn find(&mut self, id: u32) -> Option<&mut T> {
131131
let idx = id as usize;
132132
if idx < self.slots.len() {
133133
match self.slots[idx] {
@@ -139,7 +139,7 @@ impl <T> ExportTable<T> {
139139
}
140140
}
141141

142-
pub fn iter<'a>(&'a self) -> ExportTableIter<'a, T> {
142+
pub fn iter(&self) -> ExportTableIter<T> {
143143
ExportTableIter {
144144
table: self,
145145
idx: 0
@@ -1586,7 +1586,7 @@ impl <VatId> Clone for Response<VatId> {
15861586
}
15871587

15881588
impl <VatId> ResponseHook for Response<VatId> {
1589-
fn get<'a>(&'a self) -> ::capnp::Result<any_pointer::Reader<'a>> {
1589+
fn get(&self) -> ::capnp::Result<any_pointer::Reader> {
15901590
match *self.variant {
15911591
ResponseVariant::Rpc(ref state) => {
15921592
match state.message.get_body()?.get_as::<message::Reader>()?.which()? {
@@ -1617,8 +1617,8 @@ struct Request<VatId> where VatId: 'static {
16171617
cap_table: Vec<Option<Box<dyn ClientHook>>>,
16181618
}
16191619

1620-
fn get_call<'a>(message: &'a mut Box<dyn crate::OutgoingMessage>)
1621-
-> ::capnp::Result<call::Builder<'a>>
1620+
fn get_call(message: &mut Box<dyn crate::OutgoingMessage>)
1621+
-> ::capnp::Result<call::Builder>
16221622
{
16231623
let message_root: message::Builder = message.get_body()?.get_as()?;
16241624
match message_root.which()? {
@@ -1645,7 +1645,7 @@ impl <VatId> Request<VatId> where VatId: 'static {
16451645
})
16461646
}
16471647

1648-
fn init_call<'a>(&'a mut self) -> call::Builder<'a> {
1648+
fn init_call(&mut self) -> call::Builder {
16491649
let message_root: message::Builder = self.message.get_body().unwrap().get_as().unwrap();
16501650
message_root.init_call()
16511651
}
@@ -1697,7 +1697,7 @@ impl <VatId> Request<VatId> where VatId: 'static {
16971697
}
16981698

16991699
impl <VatId> RequestHook for Request<VatId> {
1700-
fn get<'a>(&'a mut self) -> any_pointer::Builder<'a> {
1700+
fn get(&mut self) -> any_pointer::Builder {
17011701
use ::capnp::traits::ImbueMut;
17021702
let mut builder = get_call(&mut self.message).unwrap().get_params().unwrap().get_content();
17031703
builder.imbue_mut(&mut self.cap_table);
@@ -1964,7 +1964,7 @@ impl Params {
19641964
}
19651965

19661966
impl ParamsHook for Params {
1967-
fn get<'a>(&'a self) -> ::capnp::Result<any_pointer::Reader<'a>> {
1967+
fn get(&self) -> ::capnp::Result<any_pointer::Reader> {
19681968
let root: message::Reader = self.request.get_body()?.get_as()?;
19691969
match root.which()? {
19701970
message::Call(call) => {
@@ -2062,7 +2062,7 @@ impl <VatId> Drop for Results<VatId> {
20622062
}
20632063

20642064
impl <VatId> ResultsHook for Results<VatId> {
2065-
fn get<'a>(&'a mut self) -> ::capnp::Result<any_pointer::Builder<'a>> {
2065+
fn get(&mut self) -> ::capnp::Result<any_pointer::Builder> {
20662066
use ::capnp::traits::ImbueMut;
20672067
if let Some(ref mut inner) = self.inner {
20682068
inner.ensure_initialized();
@@ -2287,7 +2287,7 @@ impl ResultsDoneHook for ResultsDone {
22872287
fn add_ref(&self) -> Box<dyn ResultsDoneHook> {
22882288
Box::new(ResultsDone { inner: self.inner.clone() })
22892289
}
2290-
fn get<'a>(&'a self) -> ::capnp::Result<any_pointer::Reader<'a>> {
2290+
fn get(&self) -> ::capnp::Result<any_pointer::Reader> {
22912291
use ::capnp::traits::Imbue;
22922292
match *self.inner {
22932293
ResultsDoneVariant::Rpc(ref message, ref cap_table) => {

capnp-rpc/src/twoparty.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl IncomingMessage {
4242
}
4343

4444
impl crate::IncomingMessage for IncomingMessage {
45-
fn get_body<'a>(&'a self) -> ::capnp::Result<::capnp::any_pointer::Reader<'a>> {
45+
fn get_body(&self) -> ::capnp::Result<::capnp::any_pointer::Reader> {
4646
self.message.get_root()
4747
}
4848
}
@@ -53,11 +53,11 @@ struct OutgoingMessage {
5353
}
5454

5555
impl crate::OutgoingMessage for OutgoingMessage {
56-
fn get_body<'a>(&'a mut self) -> ::capnp::Result<::capnp::any_pointer::Builder<'a>> {
56+
fn get_body(&mut self) -> ::capnp::Result<::capnp::any_pointer::Builder> {
5757
self.message.get_root()
5858
}
5959

60-
fn get_body_as_reader<'a>(&'a self) -> ::capnp::Result<::capnp::any_pointer::Reader<'a>> {
60+
fn get_body_as_reader(&self) -> ::capnp::Result<::capnp::any_pointer::Reader> {
6161
self.message.get_root_as_reader()
6262
}
6363

capnp/src/capability.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl <T> Params <T> {
182182
pub fn new(hook: Box<dyn ParamsHook>) -> Params<T> {
183183
Params { marker: PhantomData, hook }
184184
}
185-
pub fn get<'a>(&'a self) -> crate::Result<T::Reader<'a>>
185+
pub fn get(&self) -> crate::Result<T::Reader<'_>>
186186
where T: Owned
187187
{
188188
self.hook.get()?.get_as()

capnp/src/message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ impl <A> Builder<A> where A: Allocator {
434434
Ok(())
435435
}
436436

437-
pub fn get_segments_for_output(&self) -> OutputSegments<'_> {
437+
pub fn get_segments_for_output(&self) -> OutputSegments {
438438
self.arena.get_segments_for_output()
439439
}
440440

capnp/src/private/arena.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ impl <A> BuilderArenaImpl<A> where A: Allocator {
179179
self.inner.borrow_mut().allocate_segment(minimum_size)
180180
}
181181

182-
pub fn get_segments_for_output(&self) -> OutputSegments<'_> {
182+
pub fn get_segments_for_output(&self) -> OutputSegments {
183183
let reff = self.inner.borrow();
184184
if reff.segments.len() == 1 {
185185
let seg = &reff.segments[0];

capnpc/src/codegen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl <'a> GeneratorContext<'a> {
200200
Ok(gen)
201201
}
202202

203-
fn get_last_name<'b>(&'b self, id: u64) -> ::capnp::Result<&'b str> {
203+
fn get_last_name(&self, id: u64) -> ::capnp::Result<&str> {
204204
match self.scope_map.get(&id) {
205205
None => Err(Error::failed(format!("node not found: {}", id))),
206206
Some(v) => match v.last() {

0 commit comments

Comments
 (0)