Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
parity-bitcoin
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
parity-bitcoin
Commits
c71ef6a1
Commit
c71ef6a1
authored
5 years ago
by
amanusk
Browse files
Options
Downloads
Patches
Plain Diff
Remove warnings for range patterns
parent
f537425d
Branches
Branches containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
serialization/src/compact_integer.rs
+7
-7
7 additions, 7 deletions
serialization/src/compact_integer.rs
serialization/src/reader.rs
+1
-1
1 addition, 1 deletion
serialization/src/reader.rs
with
8 additions
and
8 deletions
serialization/src/compact_integer.rs
+
7
−
7
View file @
c71ef6a1
...
...
@@ -61,15 +61,15 @@ impl From<u64> for CompactInteger {
impl
Serializable
for
CompactInteger
{
fn
serialize
(
&
self
,
stream
:
&
mut
Stream
)
{
match
self
.0
{
0
..
.
0xfc
=>
{
0
..
=
0xfc
=>
{
stream
.append
(
&
(
self
.0
as
u8
));
},
0xfd
..
.
0xffff
=>
{
0xfd
..
=
0xffff
=>
{
stream
.append
(
&
0xfdu8
)
.append
(
&
(
self
.0
as
u16
));
},
0x10000
..
.
0xffff_ffff
=>
{
0x10000
..
=
0xffff_ffff
=>
{
stream
.append
(
&
0xfeu8
)
.append
(
&
(
self
.0
as
u32
));
...
...
@@ -84,9 +84,9 @@ impl Serializable for CompactInteger {
fn
serialized_size
(
&
self
)
->
usize
{
match
self
.0
{
0
..
.
0xfc
=>
1
,
0xfd
..
.
0xffff
=>
3
,
0x10000
..
.
0xffff_ffff
=>
5
,
0
..
=
0xfc
=>
1
,
0xfd
..
=
0xffff
=>
3
,
0x10000
..
=
0xffff_ffff
=>
5
,
_
=>
9
,
}
}
...
...
@@ -95,7 +95,7 @@ impl Serializable for CompactInteger {
impl
Deserializable
for
CompactInteger
{
fn
deserialize
<
T
>
(
reader
:
&
mut
Reader
<
T
>
)
->
Result
<
Self
,
ReaderError
>
where
T
:
io
::
Read
{
let
result
=
match
try
!
(
reader
.read
::
<
u8
>
())
{
i
@
0
..
.
0xfc
=>
i
.into
(),
i
@
0
..
=
0xfc
=>
i
.into
(),
0xfd
=>
try
!
(
reader
.read
::
<
u16
>
())
.into
(),
0xfe
=>
try
!
(
reader
.read
::
<
u32
>
())
.into
(),
_
=>
try
!
(
reader
.read
::
<
u64
>
())
.into
(),
...
...
This diff is collapsed.
Click to expand it.
serialization/src/reader.rs
+
1
−
1
View file @
c71ef6a1
...
...
@@ -89,7 +89,7 @@ impl<R> Reader<R> where R: io::Read {
T
::
deserialize
(
&
mut
reader
)
}
pub
fn
skip_while
(
&
mut
self
,
predicate
:
&
Fn
(
u8
)
->
bool
)
->
Result
<
(),
Error
>
{
pub
fn
skip_while
(
&
mut
self
,
predicate
:
&
dyn
Fn
(
u8
)
->
bool
)
->
Result
<
(),
Error
>
{
let
mut
next_buffer
=
[
0u8
];
loop
{
let
next
=
match
self
.peeked
.take
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment