diff options
author | Joel Galenson <jgalenson@google.com> | 2021-05-19 17:24:08 -0700 |
---|---|---|
committer | Joel Galenson <jgalenson@google.com> | 2021-05-19 17:24:08 -0700 |
commit | fdd477442016fa3579b7b97a42e52e2340149ba7 (patch) | |
tree | 55e4cdf9420132a0989e9bd5f7d78c533a2b95ec /src/generics.rs | |
parent | 378cd52597b55bd262c21722d1c2639c7a4e21a2 (diff) | |
download | syn-fdd477442016fa3579b7b97a42e52e2340149ba7.tar.gz |
Upgrade rust/crates/syn to 1.0.72
Test: make
Change-Id: Ie700357fdff8bb1a8c760adb67274f6b91c42eb3
Diffstat (limited to 'src/generics.rs')
-rw-r--r-- | src/generics.rs | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/generics.rs b/src/generics.rs index de0772a7..0950c1cb 100644 --- a/src/generics.rs +++ b/src/generics.rs @@ -172,17 +172,10 @@ impl Generics { /// Initializes an empty `where`-clause if there is not one present already. pub fn make_where_clause(&mut self) -> &mut WhereClause { - // This is Option::get_or_insert_with in Rust 1.20. - if self.where_clause.is_none() { - self.where_clause = Some(WhereClause { - where_token: <Token![where]>::default(), - predicates: Punctuated::new(), - }); - } - match &mut self.where_clause { - Some(where_clause) => where_clause, - None => unreachable!(), - } + self.where_clause.get_or_insert_with(|| WhereClause { + where_token: <Token![where]>::default(), + predicates: Punctuated::new(), + }) } } |