From 18ab269a0e6967d78df8527679f2479c39650250 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 28 Sep 2021 09:59:15 +0300 Subject: Add an is_empty method when len is there It is customary for Rust data container structures to have both is_empty and len, methods, because is_empty can both more to the point and also faster to implement. Sometimes is_empty makes no sense, as it doesn't for openpgp::types::Curve, which isn't a container structure. Arguably it would be better to rename Curve::len to something like Curve::bits, but as that would change the API, I've opted to tell clippy that not having is_empty in this case is OK. Found by clippy lint len_without_is_empty: https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty --- openpgp/src/types/mod.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'openpgp') diff --git a/openpgp/src/types/mod.rs b/openpgp/src/types/mod.rs index cdad569f..833ca480 100644 --- a/openpgp/src/types/mod.rs +++ b/openpgp/src/types/mod.rs @@ -387,6 +387,7 @@ const ED25519_OID: &[u8] = const CV25519_OID: &[u8] = &[0x2B, 0x06, 0x01, 0x04, 0x01, 0x97, 0x55, 0x01, 0x05, 0x01]; +#[allow(clippy::len_without_is_empty)] impl Curve { /// Parses the given OID. /// -- cgit v1.2.3