We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Option::map
match
1 parent 10d8213 commit cbe5f1cCopy full SHA for cbe5f1c
src/libsyntax_ext/deriving/generic/ty.rs
@@ -138,17 +138,13 @@ pub fn nil_ty<'r>() -> Ty<'r> {
138
}
139
140
fn mk_lifetime(cx: &ExtCtxt, span: Span, lt: &Option<&str>) -> Option<ast::Lifetime> {
141
- match *lt {
142
- Some(s) => Some(cx.lifetime(span, Ident::from_str(s))),
143
- None => None,
144
- }
+ lt.map(|s|
+ cx.lifetime(span, Ident::from_str(s))
+ )
145
146
147
fn mk_lifetimes(cx: &ExtCtxt, span: Span, lt: &Option<&str>) -> Vec<ast::Lifetime> {
148
149
- Some(s) => vec![cx.lifetime(span, Ident::from_str(s))],
150
- None => vec![],
151
+ mk_lifetime(cx, span, lt).into_iter().collect()
152
153
154
impl<'a> Ty<'a> {
0 commit comments