@@ -71,15 +71,15 @@ fn ident_string(id: &str) -> String {
71
71
}
72
72
}
73
73
74
- pub fn pp_text ( id : & str ) -> RcDoc {
74
+ pub fn pp_text ( id : & str ) -> RcDoc < ' _ > {
75
75
RcDoc :: text ( ident_string ( id) )
76
76
}
77
77
78
- pub fn pp_ty ( ty : & Type ) -> RcDoc {
78
+ pub fn pp_ty ( ty : & Type ) -> RcDoc < ' _ > {
79
79
pp_ty_inner ( ty. as_ref ( ) )
80
80
}
81
81
82
- pub fn pp_ty_inner ( ty : & TypeInner ) -> RcDoc {
82
+ pub fn pp_ty_inner ( ty : & TypeInner ) -> RcDoc < ' _ > {
83
83
use TypeInner :: * ;
84
84
match ty {
85
85
Null => str ( "null" ) ,
@@ -130,18 +130,18 @@ pub fn pp_docs<'a>(docs: &'a [String]) -> RcDoc<'a> {
130
130
/// This function is kept for backward compatibility.
131
131
///
132
132
/// It is recommended to use [`pp_label_raw`] instead, which accepts a [`Label`].
133
- pub fn pp_label ( id : & SharedLabel ) -> RcDoc {
133
+ pub fn pp_label ( id : & SharedLabel ) -> RcDoc < ' _ > {
134
134
pp_label_raw ( id. as_ref ( ) )
135
135
}
136
136
137
- pub fn pp_label_raw ( id : & Label ) -> RcDoc {
137
+ pub fn pp_label_raw ( id : & Label ) -> RcDoc < ' _ > {
138
138
match id {
139
139
Label :: Named ( id) => pp_text ( id) ,
140
140
Label :: Id ( _) | Label :: Unnamed ( _) => RcDoc :: as_string ( id) ,
141
141
}
142
142
}
143
143
144
- pub ( crate ) fn pp_field ( field : & Field , is_variant : bool ) -> RcDoc {
144
+ pub ( crate ) fn pp_field ( field : & Field , is_variant : bool ) -> RcDoc < ' _ > {
145
145
let ty_doc = if is_variant && * field. ty == TypeInner :: Null {
146
146
RcDoc :: nil ( )
147
147
} else {
@@ -150,12 +150,12 @@ pub(crate) fn pp_field(field: &Field, is_variant: bool) -> RcDoc {
150
150
pp_label_raw ( & field. id ) . append ( ty_doc)
151
151
}
152
152
153
- fn pp_fields ( fs : & [ Field ] , is_variant : bool ) -> RcDoc {
153
+ fn pp_fields ( fs : & [ Field ] , is_variant : bool ) -> RcDoc < ' _ > {
154
154
let fields = fs. iter ( ) . map ( |f| pp_field ( f, is_variant) ) ;
155
155
enclose_space ( "{" , concat ( fields, ";" ) , "}" )
156
156
}
157
157
158
- pub fn pp_function ( func : & Function ) -> RcDoc {
158
+ pub fn pp_function ( func : & Function ) -> RcDoc < ' _ > {
159
159
let args = pp_named_args ( & func. args ) ;
160
160
let rets = pp_rets ( & func. rets ) ;
161
161
let modes = pp_modes ( & func. modes ) ;
@@ -168,7 +168,7 @@ pub fn pp_function(func: &Function) -> RcDoc {
168
168
/// Pretty-prints named arguments in the form of `(name1 : type1, name2 : type2)`.
169
169
///
170
170
/// To print unnamed arguments, use [`pp_args`] instead.
171
- pub fn pp_named_args ( args : & [ ArgType ] ) -> RcDoc {
171
+ pub fn pp_named_args ( args : & [ ArgType ] ) -> RcDoc < ' _ > {
172
172
let args = args. iter ( ) . map ( |arg| {
173
173
if let Some ( name) = & arg. name {
174
174
pp_text ( name) . append ( kwd ( " :" ) ) . append ( pp_ty ( & arg. typ ) )
@@ -183,24 +183,24 @@ pub fn pp_named_args(args: &[ArgType]) -> RcDoc {
183
183
/// Pretty-prints arguments in the form of `(type1, type2)`.
184
184
///
185
185
/// To print named arguments, use [`pp_named_args`] instead.
186
- pub fn pp_args ( args : & [ Type ] ) -> RcDoc {
186
+ pub fn pp_args ( args : & [ Type ] ) -> RcDoc < ' _ > {
187
187
let doc = concat ( args. iter ( ) . map ( pp_ty) , "," ) ;
188
188
enclose ( "(" , doc, ")" )
189
189
}
190
190
191
191
/// Pretty-prints return types in the form of `(type1, type2)`.
192
- pub fn pp_rets ( args : & [ Type ] ) -> RcDoc {
192
+ pub fn pp_rets ( args : & [ Type ] ) -> RcDoc < ' _ > {
193
193
pp_args ( args)
194
194
}
195
195
196
- pub fn pp_mode ( mode : & FuncMode ) -> RcDoc {
196
+ pub fn pp_mode ( mode : & FuncMode ) -> RcDoc < ' _ > {
197
197
match mode {
198
198
FuncMode :: Oneway => RcDoc :: text ( "oneway" ) ,
199
199
FuncMode :: Query => RcDoc :: text ( "query" ) ,
200
200
FuncMode :: CompositeQuery => RcDoc :: text ( "composite_query" ) ,
201
201
}
202
202
}
203
- pub fn pp_modes ( modes : & [ FuncMode ] ) -> RcDoc {
203
+ pub fn pp_modes ( modes : & [ FuncMode ] ) -> RcDoc < ' _ > {
204
204
RcDoc :: concat ( modes. iter ( ) . map ( |m| RcDoc :: space ( ) . append ( pp_mode ( m) ) ) )
205
205
}
206
206
@@ -223,7 +223,7 @@ fn pp_service<'a>(serv: &'a [(String, Type)], docs: Option<&'a DocComments>) ->
223
223
enclose_space ( "{" , doc, "}" )
224
224
}
225
225
226
- fn pp_defs ( env : & TypeEnv ) -> RcDoc {
226
+ fn pp_defs ( env : & TypeEnv ) -> RcDoc < ' _ > {
227
227
lines ( env. to_sorted_iter ( ) . map ( |( id, ty) | {
228
228
kwd ( "type" )
229
229
. append ( ident ( id. as_str ( ) ) )
@@ -523,7 +523,7 @@ pub mod value {
523
523
}
524
524
}
525
525
526
- fn pp_field ( depth : usize , field : & IDLField , is_variant : bool ) -> RcDoc {
526
+ fn pp_field ( depth : usize , field : & IDLField , is_variant : bool ) -> RcDoc < ' _ > {
527
527
let val_doc = if is_variant && field. val == IDLValue :: Null {
528
528
RcDoc :: nil ( )
529
529
} else {
@@ -532,7 +532,7 @@ pub mod value {
532
532
pp_label_raw ( & field. id ) . append ( val_doc)
533
533
}
534
534
535
- fn pp_fields ( depth : usize , fields : & [ IDLField ] ) -> RcDoc {
535
+ fn pp_fields ( depth : usize , fields : & [ IDLField ] ) -> RcDoc < ' _ > {
536
536
let fs = concat ( fields. iter ( ) . map ( |f| pp_field ( depth, f, false ) ) , ";" ) ;
537
537
enclose_space ( "{" , fs, "}" )
538
538
}
@@ -545,7 +545,7 @@ pub mod value {
545
545
format ! ( "\\ {v:02x}" )
546
546
}
547
547
}
548
- pub fn pp_value ( depth : usize , v : & IDLValue ) -> RcDoc {
548
+ pub fn pp_value ( depth : usize , v : & IDLValue ) -> RcDoc < ' _ > {
549
549
use IDLValue :: * ;
550
550
if depth == 0 {
551
551
return RcDoc :: as_string ( format ! ( "{v:?}" ) ) ;
@@ -579,7 +579,7 @@ pub mod value {
579
579
}
580
580
}
581
581
582
- pub fn pp_args ( args : & IDLArgs ) -> RcDoc {
582
+ pub fn pp_args ( args : & IDLArgs ) -> RcDoc < ' _ > {
583
583
let args = args
584
584
. args
585
585
. iter ( )
0 commit comments