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
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
2c349104
Commit
2c349104
authored
7 years ago
by
nanocryk
Browse files
Options
Downloads
Plain Diff
Merge branch 'ci' into 'dev'
Apply rustfmt diff in gitlab-CI See merge request
!6
parents
f072fe69
c84ff91c
No related branches found
No related tags found
1 merge request
!6
Apply rustfmt diff in gitlab-CI
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+11
-0
11 additions, 0 deletions
.gitlab-ci.yml
wotb/lib.rs
+8
-18
8 additions, 18 deletions
wotb/lib.rs
with
19 additions
and
18 deletions
.gitlab-ci.yml
+
11
−
0
View file @
2c349104
stages
:
stages
:
-
builds
-
builds
-
tests
-
tests
-
fmt
before_script
:
before_script
:
-
export PATH="$HOME/.cargo/bin:$PATH"
-
export PATH="$HOME/.cargo/bin:$PATH"
...
@@ -18,3 +19,13 @@ tests:
...
@@ -18,3 +19,13 @@ tests:
-
redshift-rs
-
redshift-rs
script
:
script
:
-
cargo test
-
cargo test
fmt
:
stage
:
fmt
tags
:
-
redshift-rs-nightly
before_script
:
-
export PATH="$HOME/.cargo/bin:$PATH"
-
cargo install --force rustfmt-nightly
script
:
-
cargo fmt -- --write-mode=diff
This diff is collapsed.
Click to expand it.
wotb/lib.rs
+
8
−
18
View file @
2c349104
...
@@ -23,17 +23,14 @@
...
@@ -23,17 +23,14 @@
//! [Duniter]: https://duniter.org/
//! [Duniter]: https://duniter.org/
//! [js-tests]: https://github.com/duniter/wotb/blob/master/wotcpp/webOfTrust.cpp
//! [js-tests]: https://github.com/duniter/wotb/blob/master/wotcpp/webOfTrust.cpp
#![deny(missing_docs,
#![deny(missing_docs,
missing_debug_implementations,
missing_copy_implementations,
trivial_casts,
missing_debug_implementations,
missing_copy_implementations,
trivial_numeric_casts,
unsafe_code,
unstable_features,
unused_import_braces,
trivial_casts,
trivial_numeric_casts,
unused_qualifications)]
unsafe_code,
unstable_features,
unused_import_braces,
unused_qualifications)]
extern
crate
bincode
;
extern
crate
serde
;
extern
crate
serde
;
#[macro_use]
#[macro_use]
extern
crate
serde_derive
;
extern
crate
serde_derive
;
extern
crate
bincode
;
use
std
::
collections
::
HashSet
;
use
std
::
collections
::
HashSet
;
use
std
::
collections
::
hash_set
::
Iter
;
use
std
::
collections
::
hash_set
::
Iter
;
...
@@ -41,7 +38,7 @@ use std::rc::Rc;
...
@@ -41,7 +38,7 @@ use std::rc::Rc;
use
std
::
fs
::
File
;
use
std
::
fs
::
File
;
use
std
::
io
::
prelude
::
*
;
use
std
::
io
::
prelude
::
*
;
use
bincode
::{
serialize
,
de
serialize
,
Infinite
};
use
bincode
::{
de
serialize
,
serialize
,
Infinite
};
/// Wrapper for a node id.
/// Wrapper for a node id.
#[derive(Debug,
Copy,
Clone,
PartialEq,
Eq,
Hash,
Serialize,
Deserialize)]
#[derive(Debug,
Copy,
Clone,
PartialEq,
Eq,
Hash,
Serialize,
Deserialize)]
...
@@ -286,9 +283,7 @@ impl WebOfTrust {
...
@@ -286,9 +283,7 @@ impl WebOfTrust {
let
mut
sentries
:
Vec
<
bool
>
=
self
.nodes
let
mut
sentries
:
Vec
<
bool
>
=
self
.nodes
.iter
()
.iter
()
.map
(|
x
|
{
.map
(|
x
|
x
.enabled
&&
x
.issued_count
()
>=
d_min
&&
x
.links_iter
()
.count
()
>=
d_min
)
x
.enabled
&&
x
.issued_count
()
>=
d_min
&&
x
.links_iter
()
.count
()
>=
d_min
})
.collect
();
.collect
();
sentries
[
member
.0
]
=
false
;
sentries
[
member
.0
]
=
false
;
...
@@ -318,9 +313,7 @@ impl WebOfTrust {
...
@@ -318,9 +313,7 @@ impl WebOfTrust {
pub
fn
get_sentries
(
&
self
,
d_min
:
usize
)
->
Vec
<
NodeId
>
{
pub
fn
get_sentries
(
&
self
,
d_min
:
usize
)
->
Vec
<
NodeId
>
{
self
.nodes
self
.nodes
.iter
()
.iter
()
.filter
(|
x
|
{
.filter
(|
x
|
x
.enabled
&&
x
.issued_count
()
>=
d_min
&&
x
.links_iter
()
.count
()
>=
d_min
)
x
.enabled
&&
x
.issued_count
()
>=
d_min
&&
x
.links_iter
()
.count
()
>=
d_min
})
.map
(|
x
|
x
.id
())
.map
(|
x
|
x
.id
())
.collect
()
.collect
()
}
}
...
@@ -329,9 +322,7 @@ impl WebOfTrust {
...
@@ -329,9 +322,7 @@ impl WebOfTrust {
pub
fn
get_non_sentries
(
&
self
,
d_min
:
usize
)
->
Vec
<
NodeId
>
{
pub
fn
get_non_sentries
(
&
self
,
d_min
:
usize
)
->
Vec
<
NodeId
>
{
self
.nodes
self
.nodes
.iter
()
.iter
()
.filter
(|
x
|
{
.filter
(|
x
|
x
.enabled
&&
(
x
.issued_count
<
d_min
||
x
.links_iter
()
.count
()
<
d_min
))
x
.enabled
&&
(
x
.issued_count
<
d_min
||
x
.links_iter
()
.count
()
<
d_min
)
})
.map
(|
x
|
x
.id
())
.map
(|
x
|
x
.id
())
.collect
()
.collect
()
}
}
...
@@ -818,6 +809,5 @@ mod tests {
...
@@ -818,6 +809,5 @@ mod tests {
wot2
.get_non_sentries
(
1
)
.len
()
wot2
.get_non_sentries
(
1
)
.len
()
);
);
}
}
}
}
}
}
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