|
2 | 2 | // or more contributor license agreements. See the NOTICE file |
3 | 3 | // distributed with this work for additional information |
4 | 4 | // regarding copyright ownership. The ASF licenses this file |
5 | | -// to you under the Apache License, Version 2.kind() (the |
| 5 | +// to you under the Apache License, Version 2.0 (the |
6 | 6 | // "License"); you may not use this file except in compliance |
7 | 7 | // with the License. You may obtain a copy of the License at |
8 | 8 | // |
9 | | -// http://www.apache.org/licenses/LICENSE-2.kind() |
| 9 | +// http://www.apache.org/licenses/LICENSE-2.0 |
10 | 10 | // |
11 | 11 | // Unless required by applicable law or agreed to in writing, |
12 | 12 | // software distributed under the License is distributed on an |
@@ -105,15 +105,14 @@ pub fn infer_json_type<'a, 't>( |
105 | 105 | let elem = value |
106 | 106 | .elements() |
107 | 107 | .try_fold(expected_elem, |expected, value| { |
108 | | - let result = infer_json_type(value, expected, arena); |
109 | | - result |
| 108 | + infer_json_type(value, expected, arena) |
110 | 109 | })?; |
111 | 110 |
|
112 | | - Ok(if elem.ptr_eq(expected_elem) { |
113 | | - expected |
114 | | - } else { |
115 | | - InferredType::new_array(elem, arena) |
116 | | - }) |
| 111 | + if elem.ptr_eq(expected_elem) { |
| 112 | + return Ok(expected); |
| 113 | + } |
| 114 | + |
| 115 | + Ok(InferredType::new_array(elem, arena)) |
117 | 116 | } |
118 | 117 | JsonType::Object => { |
119 | 118 | let (expected, expected_fields) = match *expected.kind() { |
|
0 commit comments