Skip to content

Commit bca9c21

Browse files
committed
Remove unnecessary lifetimes
1 parent 7b3995d commit bca9c21

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

src/dump.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ impl<'a> Dumper<'a> {
741741
}
742742
}
743743

744-
impl<'a> Default for Dumper<'a> {
744+
impl Default for Dumper<'_> {
745745
fn default() -> Self {
746746
Self::new()
747747
}

src/load.rs

+35-35
Original file line numberDiff line numberDiff line change
@@ -237,46 +237,46 @@ impl<'a> Loader<'a> {
237237

238238
if let Some(str) = unsafe { &*object.get() }["__type"].as_str() {
239239
if str == "bytes"
240-
&& [
241-
Value::from(ENCODING_LONG_SYMBOL),
242-
Value::from(ENCODING_SHORT_SYMBOL),
243-
]
244-
.contains(unsafe { &*key.get() })
245-
&& self.string_mode != Some(StringMode::Binary)
246-
{
247-
let bytes: Value = unsafe { &*object.get() }["data"].clone();
248-
let array: Vec<u8>;
249-
250-
#[cfg(feature = "sonic")]
240+
&& [
241+
Value::from(ENCODING_LONG_SYMBOL),
242+
Value::from(ENCODING_SHORT_SYMBOL),
243+
]
244+
.contains(unsafe { &*key.get() })
245+
&& self.string_mode != Some(StringMode::Binary)
251246
{
252-
array = from_value(&bytes).unwrap()
253-
}
254-
#[cfg(not(feature = "sonic"))]
255-
{
256-
array = from_value(bytes).unwrap()
257-
}
247+
let bytes: Value = unsafe { &*object.get() }["data"].clone();
248+
let array: Vec<u8>;
258249

259-
if unsafe { &*key.get() } == ENCODING_SHORT_SYMBOL {
260-
unsafe {
261-
*object.get() = (std::str::from_utf8_unchecked(&array)).into();
250+
#[cfg(feature = "sonic")]
251+
{
252+
array = from_value(&bytes).unwrap()
262253
}
263-
} else {
264-
let (cow, _, _) = Encoding::for_label(&value.unwrap())
265-
.unwrap_or(UTF_8)
266-
.decode(&array);
267-
unsafe {
268-
#[cfg(feature = "sonic")]
269-
{
270-
*object.get() = cow.into();
254+
#[cfg(not(feature = "sonic"))]
255+
{
256+
array = from_value(bytes).unwrap()
257+
}
258+
259+
if unsafe { &*key.get() } == ENCODING_SHORT_SYMBOL {
260+
unsafe {
261+
*object.get() = (std::str::from_utf8_unchecked(&array)).into();
271262
}
272-
#[cfg(not(feature = "sonic"))]
273-
{
274-
*object.get() = (cow.into_owned()).into();
263+
} else {
264+
let (cow, _, _) = Encoding::for_label(&value.unwrap())
265+
.unwrap_or(UTF_8)
266+
.decode(&array);
267+
unsafe {
268+
#[cfg(feature = "sonic")]
269+
{
270+
*object.get() = cow.into();
271+
}
272+
#[cfg(not(feature = "sonic"))]
273+
{
274+
*object.get() = (cow.into_owned()).into();
275+
}
275276
}
276-
}
277277

278-
*self.objects.last_mut().unwrap() = object.clone()
279-
}
278+
*self.objects.last_mut().unwrap() = object.clone()
279+
}
280280
}
281281
}
282282
}
@@ -566,7 +566,7 @@ impl<'a> Loader<'a> {
566566
}
567567
}
568568

569-
impl<'a> Default for Loader<'a> {
569+
impl Default for Loader<'_> {
570570
fn default() -> Self {
571571
Self::new()
572572
}

0 commit comments

Comments
 (0)