Skip to content
Snippets Groups Projects
Commit 41cbf9db authored by Éloïs's avatar Éloïs
Browse files

Merge branch '38-comply-to-fmt-and-clippy-lints' into 'dev'

Resolve "Comply to fmt and clippy lints"

Closes #38

See merge request !27
parents adcf0a60 26abcd35
No related branches found
No related tags found
1 merge request!27Resolve "Comply to fmt and clippy lints"
......@@ -116,7 +116,7 @@ impl<'a> IdentityDocumentBuilder<'a> {
signatures: Vec<ed25519::Signature>,
) -> IdentityDocument {
IdentityDocument {
text: text,
text,
currency: self.currency.to_string(),
unique_id: self.unique_id.to_string(),
blockstamp: *self.blockstamp,
......@@ -183,7 +183,7 @@ impl StandardTextDocumentParser for IdentityDocumentParser {
text: doc.to_owned(),
currency: currency.to_owned(),
unique_id: uid.to_owned(),
blockstamp: blockstamp,
blockstamp,
issuers: vec![issuer],
signatures,
}))
......
......@@ -141,7 +141,7 @@ impl<'a> MembershipDocumentBuilder<'a> {
signatures: Vec<ed25519::Signature>,
) -> MembershipDocument {
MembershipDocument {
text: text,
text,
currency: self.currency.to_string(),
issuers: vec![*self.issuer],
blockstamp: *self.blockstamp,
......@@ -227,7 +227,7 @@ impl StandardTextDocumentParser for MembershipDocumentParser {
text: doc.to_owned(),
issuers: vec![issuer],
currency: currency.to_owned(),
blockstamp: blockstamp,
blockstamp,
membership,
identity_username: username.to_owned(),
identity_blockstamp: ity_block,
......
......@@ -35,10 +35,7 @@ lazy_static! {
(?P<body>(?:.*\n)+?))\
(?P<sigs>([[:alnum:]+/=]+\n)*([[:alnum:]+/=]+))$"
).unwrap();
static ref SIGNATURES_REGEX: Regex = Regex::new(
"[[:alnum:]+/=]+\n?"
).unwrap();
static ref SIGNATURES_REGEX: Regex = Regex::new("[[:alnum:]+/=]+\n?").unwrap();
}
/// List of wrapped document types.
......
......@@ -13,7 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//! Provide a legacy implementation of *WoT* storage and calculations.
//! Provide a legacy implementation of `WebOfTrust` storage and calculations.
//! Its mostly translated directly from the original C++ code.
use WotDistance;
......@@ -143,7 +143,7 @@ impl LegacyWebOfTrust {
}
}
/// Read *WoT* from file.
/// Read `WoT` from file.
pub fn legacy_from_file(path: &str) -> Option<LegacyWebOfTrust> {
let mut file = match File::open(path) {
Ok(file) => file,
......@@ -161,7 +161,7 @@ impl LegacyWebOfTrust {
}
}
/// Write *WoT* to file.
/// Write `WoT` to file.
pub fn legacy_to_file(&self, path: &str) -> bool {
let encoded: Vec<u8> = serialize(self, Infinite).unwrap();
......
......@@ -85,7 +85,7 @@ pub enum RemLinkResult {
UnknownTarget(),
}
/// Results of WebOfTrust parsing from binary file.
/// Results of `WebOfTrust` parsing from binary file.
#[derive(Debug)]
pub enum WotParseError {
/// FailToOpenFile
......@@ -101,7 +101,7 @@ impl From<std::io::Error> for WotParseError {
}
}
/// Results of WebOfTrust writing to binary file.
/// Results of `WebOfTrust` writing to binary file.
#[derive(Debug)]
pub enum WotWriteError {
/// WrongWotSize
......@@ -131,7 +131,7 @@ pub enum HasLinkResult {
UnknownTarget(),
}
/// Paramters for *WoT* distance calculations
/// Paramters for `WoT` distance calculations
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct WotDistanceParameters {
/// Node from where distances are calculated.
......@@ -158,7 +158,7 @@ pub struct WotDistance {
}
/// Trait for a Web Of Trust.
/// Allow to provide other implementations of the *WoT* logic instead of the legacy C++
/// Allow to provide other implementations of the `WoT` logic instead of the legacy C++
/// translated one.
pub trait WebOfTrust {
/// Get the maximum number of links per user.
......@@ -359,7 +359,7 @@ pub trait WebOfTrust {
let mut bytes = Vec::with_capacity(1);
bytes.write_u8(sources.len() as u8).unwrap();
buffer.append(&mut bytes);
for source in sources {
for source in &sources {
// Write source
let mut bytes: Vec<u8> = Vec::with_capacity(3);
bytes.write_u24::<BigEndian>(source.0 as u32).unwrap();
......
......@@ -27,7 +27,7 @@ use NewLinkResult;
use NodeId;
/// A node in the *WoT* graph.
/// A node in the `WoT` graph.
#[derive(Debug, Clone, PartialEq, Eq)]
struct Node {
/// Is this node enabled ?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment