Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Dunitrust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nodes
rust
Dunitrust
Commits
f8154e0d
Commit
f8154e0d
authored
6 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
[ref] conf: match already guarantees exhaustiveness
parent
0cec8e78
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/core/conf/lib.rs
+0
-12
0 additions, 12 deletions
lib/core/conf/lib.rs
with
0 additions
and
12 deletions
lib/core/conf/lib.rs
+
0
−
12
View file @
f8154e0d
...
@@ -101,8 +101,6 @@ impl Default for DuRsConfV1 {
...
@@ -101,8 +101,6 @@ impl Default for DuRsConfV1 {
pub
enum
DuRsConf
{
pub
enum
DuRsConf
{
/// Duniter node configuration v1
/// Duniter node configuration v1
V1
(
DuRsConfV1
),
V1
(
DuRsConfV1
),
/// Duniter node configuration v2
V2
(),
}
}
impl
Default
for
DuRsConf
{
impl
Default
for
DuRsConf
{
...
@@ -115,25 +113,21 @@ impl DuniterConf for DuRsConf {
...
@@ -115,25 +113,21 @@ impl DuniterConf for DuRsConf {
fn
version
(
&
self
)
->
usize
{
fn
version
(
&
self
)
->
usize
{
match
*
self
{
match
*
self
{
DuRsConf
::
V1
(
ref
_conf_v1
)
=>
1
,
DuRsConf
::
V1
(
ref
_conf_v1
)
=>
1
,
_
=>
panic!
(
"Fail to load duniter conf : conf version not supported !"
),
}
}
}
}
fn
currency
(
&
self
)
->
CurrencyName
{
fn
currency
(
&
self
)
->
CurrencyName
{
match
*
self
{
match
*
self
{
DuRsConf
::
V1
(
ref
conf_v1
)
=>
conf_v1
.currency
.clone
(),
DuRsConf
::
V1
(
ref
conf_v1
)
=>
conf_v1
.currency
.clone
(),
_
=>
panic!
(
"Fail to load duniter conf : conf version not supported !"
),
}
}
}
}
fn
set_currency
(
&
mut
self
,
new_currency
:
CurrencyName
)
{
fn
set_currency
(
&
mut
self
,
new_currency
:
CurrencyName
)
{
match
*
self
{
match
*
self
{
DuRsConf
::
V1
(
ref
mut
conf_v1
)
=>
conf_v1
.currency
=
new_currency
,
DuRsConf
::
V1
(
ref
mut
conf_v1
)
=>
conf_v1
.currency
=
new_currency
,
_
=>
panic!
(
"Fail to load duniter conf : conf version not supported !"
),
}
}
}
}
fn
my_node_id
(
&
self
)
->
u32
{
fn
my_node_id
(
&
self
)
->
u32
{
match
*
self
{
match
*
self
{
DuRsConf
::
V1
(
ref
conf_v1
)
=>
conf_v1
.my_node_id
,
DuRsConf
::
V1
(
ref
conf_v1
)
=>
conf_v1
.my_node_id
,
_
=>
panic!
(
"Fail to load duniter conf : conf version not supported !"
),
}
}
}
}
fn
disable
(
&
mut
self
,
module
:
ModuleName
)
{
fn
disable
(
&
mut
self
,
module
:
ModuleName
)
{
...
@@ -142,7 +136,6 @@ impl DuniterConf for DuRsConf {
...
@@ -142,7 +136,6 @@ impl DuniterConf for DuRsConf {
conf_v1
.disabled
.insert
(
module
.clone
());
conf_v1
.disabled
.insert
(
module
.clone
());
conf_v1
.enabled
.remove
(
&
module
);
conf_v1
.enabled
.remove
(
&
module
);
}
}
_
=>
panic!
(
"Fail to load duniter conf : conf version not supported !"
),
}
}
}
}
fn
enable
(
&
mut
self
,
module
:
ModuleName
)
{
fn
enable
(
&
mut
self
,
module
:
ModuleName
)
{
...
@@ -151,25 +144,21 @@ impl DuniterConf for DuRsConf {
...
@@ -151,25 +144,21 @@ impl DuniterConf for DuRsConf {
conf_v1
.disabled
.remove
(
&
module
);
conf_v1
.disabled
.remove
(
&
module
);
conf_v1
.enabled
.insert
(
module
);
conf_v1
.enabled
.insert
(
module
);
}
}
_
=>
panic!
(
"Fail to load duniter conf : conf version not supported !"
),
}
}
}
}
fn
disabled_modules
(
&
self
)
->
HashSet
<
ModuleName
>
{
fn
disabled_modules
(
&
self
)
->
HashSet
<
ModuleName
>
{
match
*
self
{
match
*
self
{
DuRsConf
::
V1
(
ref
conf_v1
)
=>
conf_v1
.disabled
.clone
(),
DuRsConf
::
V1
(
ref
conf_v1
)
=>
conf_v1
.disabled
.clone
(),
_
=>
panic!
(
"Fail to load duniter conf : conf version not supported !"
),
}
}
}
}
fn
enabled_modules
(
&
self
)
->
HashSet
<
ModuleName
>
{
fn
enabled_modules
(
&
self
)
->
HashSet
<
ModuleName
>
{
match
*
self
{
match
*
self
{
DuRsConf
::
V1
(
ref
conf_v1
)
=>
conf_v1
.enabled
.clone
(),
DuRsConf
::
V1
(
ref
conf_v1
)
=>
conf_v1
.enabled
.clone
(),
_
=>
panic!
(
"Fail to load duniter conf : conf version not supported !"
),
}
}
}
}
fn
modules
(
&
self
)
->
serde_json
::
Value
{
fn
modules
(
&
self
)
->
serde_json
::
Value
{
match
*
self
{
match
*
self
{
DuRsConf
::
V1
(
ref
conf_v1
)
=>
conf_v1
.modules
.clone
(),
DuRsConf
::
V1
(
ref
conf_v1
)
=>
conf_v1
.modules
.clone
(),
_
=>
panic!
(
"Fail to load duniter conf : conf version not supported !"
),
}
}
}
}
fn
set_module_conf
(
&
mut
self
,
module_id
:
String
,
new_module_conf
:
serde_json
::
Value
)
{
fn
set_module_conf
(
&
mut
self
,
module_id
:
String
,
new_module_conf
:
serde_json
::
Value
)
{
...
@@ -188,7 +177,6 @@ impl DuniterConf for DuRsConf {
...
@@ -188,7 +177,6 @@ impl DuniterConf for DuRsConf {
.insert
(
module_id
,
new_module_conf
);
.insert
(
module_id
,
new_module_conf
);
}
}
}
}
_
=>
panic!
(
"Fail to set duniter conf : conf version not supported !"
),
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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