Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
parity-scale-codec
Commits
783a9601
Unverified
Commit
783a9601
authored
Oct 08, 2020
by
stephaneyfx
Committed by
GitHub
Oct 08, 2020
Browse files
Always implement Display for Error (#226)
This makes it easier to write code that uses `Error` with or without `std`.
parent
c860966e
Pipeline
#109890
passed with stages
in 17 minutes and 1 second
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
src/codec.rs
View file @
783a9601
...
...
@@ -14,8 +14,7 @@
//! Serialisation.
#[cfg(feature
=
"std"
)]
use
std
::
fmt
;
use
core
::
fmt
;
use
core
::{
mem
,
ops
::
Deref
,
marker
::
PhantomData
,
iter
::
FromIterator
,
convert
::
TryFrom
,
time
::
Duration
};
use
core
::
num
::{
NonZeroI8
,
...
...
@@ -84,12 +83,19 @@ impl Error {
}
#[cfg(feature
=
"std"
)]
impl
std
::
fmt
::
Display
for
Error
{
impl
fmt
::
Display
for
Error
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
write!
(
f
,
"{}"
,
self
.0
)
}
}
#[cfg(not(feature
=
"std"
))]
impl
fmt
::
Display
for
Error
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
)
->
fmt
::
Result
{
f
.write_str
(
"Error"
)
}
}
#[cfg(feature
=
"std"
)]
impl
std
::
error
::
Error
for
Error
{
fn
description
(
&
self
)
->
&
str
{
...
...
@@ -501,8 +507,8 @@ impl<T: Decode, E: Decode> Decode for Result<T, E> {
#[derive(Eq,
PartialEq,
Clone,
Copy)]
pub
struct
OptionBool
(
pub
Option
<
bool
>
);
impl
core
::
fmt
::
Debug
for
OptionBool
{
fn
fmt
(
&
self
,
f
:
&
mut
core
::
fmt
::
Formatter
<
'_
>
)
->
core
::
fmt
::
Result
{
impl
fmt
::
Debug
for
OptionBool
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
<
'_
>
)
->
fmt
::
Result
{
self
.0
.fmt
(
f
)
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment