From 7bb658a63371df07f04054931606e6145a3816f6 Mon Sep 17 00:00:00 2001 From: cypherpunks Date: Tue, 7 Aug 2018 14:35:17 +0000 Subject: [PATCH 1/3] rust/protover: fix ProtoEntry::from_str docs Texxt was copied from a function that returned a single tuple in 88b2f170e451567a3b0095a420544a675a5826b0. --- src/rust/protover/protover.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs index 933defa705..ad1fd446e9 100644 --- a/src/rust/protover/protover.rs +++ b/src/rust/protover/protover.rs @@ -206,9 +206,7 @@ impl FromStr for ProtoEntry { /// /// # Returns /// - /// A `Result` whose `Ok` value is a `ProtoEntry`, where the - /// first element is the subprotocol type (see `protover::Protocol`) and the last - /// element is an ordered set of `(low, high)` unique version numbers which are supported. + /// A `Result` whose `Ok` value is a `ProtoEntry`. /// Otherwise, the `Err` value of this `Result` is a `ProtoverError`. fn from_str(protocol_entry: &str) -> Result { let mut proto_entry: ProtoEntry = ProtoEntry::default(); From e65a4fa42cdb3a2a0419e6178e1c141c98b28088 Mon Sep 17 00:00:00 2001 From: cypherpunks Date: Tue, 7 Aug 2018 14:52:16 +0000 Subject: [PATCH 2/3] rust/protover: fix parsing docs The function takes an already validated utf-8 string, and it never checks if the version numbers are an empty string. That parse error happens later. Fix on 701c2b69f52cb4db46aa7455904e518b35fafc1a --- src/rust/protover/protover.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs index ad1fd446e9..f8e64c822c 100644 --- a/src/rust/protover/protover.rs +++ b/src/rust/protover/protover.rs @@ -452,8 +452,9 @@ impl UnvalidatedProtoEntry { /// following are true: /// /// * If a protocol name is an empty string, e.g. `"Cons=1,3 =3-5"`. - /// * If a protocol name cannot be parsed as utf-8. - /// * If the version numbers are an empty string, e.g. `"Cons="`. + /// * If an entry has no equals sign, e.g. `"Cons=1,3 Desc"`. + /// * If there is leading or trailing whitespace, e.g. `" Cons=1,3 Link=3"`. + /// * If there is any other extra whitespice, e.g. `"Cons=1,3 Link=3"`. fn parse_protocol_and_version_str<'a>( protocol_string: &'a str, ) -> Result, ProtoverError> { From fc7fed6155ab62b1347682c0b1539a5ac292bbee Mon Sep 17 00:00:00 2001 From: cypherpunks Date: Tue, 7 Aug 2018 15:06:18 +0000 Subject: [PATCH 3/3] rust/protover: fix docs for UnvalidatedProtoEntry::from_str This got shuffled around in b786b146edd33b025774819f54d7bba3d07bf832 and hasn't been accurate since 124caf28e6db1e7bf8cdfef25c55760c81fb91b5. --- src/rust/protover/protover.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs index f8e64c822c..157027750f 100644 --- a/src/rust/protover/protover.rs +++ b/src/rust/protover/protover.rs @@ -493,11 +493,9 @@ impl FromStr for UnvalidatedProtoEntry { /// /// # Returns /// - /// A `Result` whose `Ok` value is a `ProtoSet` holding all of the - /// unique version numbers. + /// A `Result` whose `Ok` value is an `UnvalidatedProtoEntry`. /// - /// The returned `Result`'s `Err` value is an `ProtoverError` whose `Display` - /// impl has a description of the error. + /// The returned `Result`'s `Err` value is an `ProtoverError`. /// /// # Errors ///