diff --git a/protocol/blockchain/v10/documents/identity.rs b/protocol/blockchain/v10/documents/identity.rs index 5e901d74e82a3591d44c95df3c117a3f09d2754c..05762ee565f2683e3c4e2a1cd091d4a1bc46b63d 100644 --- a/protocol/blockchain/v10/documents/identity.rs +++ b/protocol/blockchain/v10/documents/identity.rs @@ -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, })) diff --git a/protocol/blockchain/v10/documents/membership.rs b/protocol/blockchain/v10/documents/membership.rs index 2710cfeae00c421ff8266da20cb34d72ba6bf64b..88b5e262aa7bf2414ded9b7251b425f16ebccb14 100644 --- a/protocol/blockchain/v10/documents/membership.rs +++ b/protocol/blockchain/v10/documents/membership.rs @@ -26,10 +26,10 @@ use blockchain::v10::documents::{StandardTextDocumentParser, TextDocument, TextD lazy_static! { static ref MEMBERSHIP_REGEX: Regex = Regex::new( "^Issuer: (?P<issuer>[1-9A-Za-z][^OIl]{43,44})\n\ -Block: (?P<blockstamp>[0-9]+-[0-9A-F]{64})\n\ -Membership: (?P<membership>(IN|OUT))\n\ -UserID: (?P<ity_user>[[:alnum:]_-]+)\n\ -CertTS: (?P<ity_block>[0-9]+-[0-9A-F]{64})\n$" + Block: (?P<blockstamp>[0-9]+-[0-9A-F]{64})\n\ + Membership: (?P<membership>(IN|OUT))\n\ + UserID: (?P<ity_user>[[:alnum:]_-]+)\n\ + CertTS: (?P<ity_block>[0-9]+-[0-9A-F]{64})\n$" ).unwrap(); } @@ -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, diff --git a/protocol/blockchain/v10/documents/mod.rs b/protocol/blockchain/v10/documents/mod.rs index 684028d255db4dce5baab69d4622894701fb84f3..b97bf576df66553ce40dd822cee15d842759a0ca 100644 --- a/protocol/blockchain/v10/documents/mod.rs +++ b/protocol/blockchain/v10/documents/mod.rs @@ -30,15 +30,12 @@ pub use blockchain::v10::documents::membership::{MembershipDocument, MembershipD lazy_static! { static ref DOCUMENT_REGEX: Regex = Regex::new( "^(?P<doc>Version: 10\n\ - Type: (?P<type>[[:alpha:]]+)\n\ - Currency: (?P<currency>[[:alnum:] _-]+)\n\ - (?P<body>(?:.*\n)+?))\ - (?P<sigs>([[:alnum:]+/=]+\n)*([[:alnum:]+/=]+))$" - ).unwrap(); - - static ref SIGNATURES_REGEX: Regex = Regex::new( - "[[:alnum:]+/=]+\n?" + Type: (?P<type>[[:alpha:]]+)\n\ + Currency: (?P<currency>[[:alnum:] _-]+)\n\ + (?P<body>(?:.*\n)+?))\ + (?P<sigs>([[:alnum:]+/=]+\n)*([[:alnum:]+/=]+))$" ).unwrap(); + static ref SIGNATURES_REGEX: Regex = Regex::new("[[:alnum:]+/=]+\n?").unwrap(); } /// List of wrapped document types. diff --git a/wotb/legacy.rs b/wotb/legacy.rs index fb8ffbe778aec2b0f28a5a5cff0c5d07f46c42ef..3cdd3e1b58962a347e117b4f878a02d919f1aec6 100644 --- a/wotb/legacy.rs +++ b/wotb/legacy.rs @@ -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(); diff --git a/wotb/lib.rs b/wotb/lib.rs index 8cd0cf6a1323f2f2beb791076ef453ac87bc5507..b9582366fbd9737331ed5adb6363f404c65c3a86 100644 --- a/wotb/lib.rs +++ b/wotb/lib.rs @@ -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(); diff --git a/wotb/rusty.rs b/wotb/rusty.rs index 4e58cea57398974714d2c9e0a8b75b5d5dedaf45..1f8b2ae7f91c68cc9ebdd6c988178f4f3ebae85d 100644 --- a/wotb/rusty.rs +++ b/wotb/rusty.rs @@ -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 ?