Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 9f621a9

Browse files
authored
Convert another instance of Into impl to From in the macros (#8986)
* Convert another instance of Into impl to From in the macros * Convert another location
1 parent 45f1630 commit 9f621a9

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

frame/support/procedural/src/construct_runtime/expand/origin.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,13 @@ pub fn expand_outer_origin(
227227
}
228228
}
229229

230-
impl Into<#scrate::sp_std::result::Result<#system_path::Origin<#runtime>, Origin>> for Origin {
230+
impl From<Origin> for #scrate::sp_std::result::Result<#system_path::Origin<#runtime>, Origin> {
231231
/// NOTE: converting to pallet origin loses the origin filter information.
232-
fn into(self) -> #scrate::sp_std::result::Result<#system_path::Origin<#runtime>, Self> {
233-
if let OriginCaller::system(l) = self.caller {
232+
fn from(val: Origin) -> Self {
233+
if let OriginCaller::system(l) = val.caller {
234234
Ok(l)
235235
} else {
236-
Err(self)
236+
Err(val)
237237
}
238238
}
239239
}
@@ -314,13 +314,13 @@ fn expand_origin_pallet_conversions(
314314
}
315315
}
316316

317-
impl Into<#scrate::sp_std::result::Result<#pallet_origin, Origin>> for Origin {
317+
impl From<Origin> for #scrate::sp_std::result::Result<#pallet_origin, Origin> {
318318
/// NOTE: converting to pallet origin loses the origin filter information.
319-
fn into(self) -> #scrate::sp_std::result::Result<#pallet_origin, Self> {
320-
if let OriginCaller::#variant(l) = self.caller {
319+
fn from(val: Origin) -> Self {
320+
if let OriginCaller::#variant(l) = val.caller {
321321
Ok(l)
322322
} else {
323-
Err(self)
323+
Err(val)
324324
}
325325
}
326326
}

frame/support/src/origin.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -382,21 +382,17 @@ macro_rules! impl_outer_origin {
382382
x.into()
383383
}
384384
}
385-
impl Into<
386-
$crate::sp_std::result::Result<
385+
impl From<$name> for $crate::sp_std::result::Result<
387386
$module::Origin < $( $generic )? $(, $module::$generic_instance )? >,
388387
$name,
389-
>>
390-
for $name {
388+
>
389+
{
391390
/// NOTE: converting to pallet origin loses the origin filter information.
392-
fn into(self) -> $crate::sp_std::result::Result<
393-
$module::Origin < $( $generic )? $(, $module::$generic_instance )? >,
394-
Self,
395-
> {
396-
if let $caller_name::[< $module $( _ $generic_instance )? >](l) = self.caller {
391+
fn from(val: $name) -> Self {
392+
if let $caller_name::[< $module $( _ $generic_instance )? >](l) = val.caller {
397393
Ok(l)
398394
} else {
399-
Err(self)
395+
Err(val)
400396
}
401397
}
402398
}

0 commit comments

Comments
 (0)