From 1992f412fec1bfff0ecf68d0a4127edc9976744e Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Fri, 7 Feb 2020 12:35:25 +0100 Subject: openpgp: Rename CertBuilder::set_expiration. --- openpgp/src/cert/builder.rs | 4 ++-- openpgp/src/cert/mod.rs | 4 ++-- tool/src/commands/key.rs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openpgp/src/cert/builder.rs b/openpgp/src/cert/builder.rs index 94d167aa..cce89fb3 100644 --- a/openpgp/src/cert/builder.rs +++ b/openpgp/src/cert/builder.rs @@ -260,7 +260,7 @@ impl CertBuilder { /// Sets the expiration time. /// /// A value of None means never. - pub fn set_expiration(mut self, expiration: T) -> Self + pub fn set_expiration_time(mut self, expiration: T) -> Self where T: Into> { self.primary.expiration = expiration.into(); @@ -583,7 +583,7 @@ mod tests { let s = std::time::Duration::new(1, 0); let (cert,_) = CertBuilder::new() - .set_expiration(600 * s) + .set_expiration_time(600 * s) .add_subkey(KeyFlags::default().set_signing(true), 300 * s) .add_subkey(KeyFlags::default().set_authentication(true), diff --git a/openpgp/src/cert/mod.rs b/openpgp/src/cert/mod.rs index f4c6fde0..0e277fd3 100644 --- a/openpgp/src/cert/mod.rs +++ b/openpgp/src/cert/mod.rs @@ -1903,8 +1903,8 @@ mod test { let p = &P::new(); let (cert, _) = CertBuilder::new() - .set_expiration(None) // Just to assert this works. - .set_expiration( + .set_expiration_time(None) // Just to assert this works. + .set_expiration_time( Some(crate::types::Duration::weeks(52).unwrap().into())) .generate().unwrap(); assert_eq!(cert.clone().into_packet_pile().children().count(), diff --git a/tool/src/commands/key.rs b/tool/src/commands/key.rs index dc9807d7..2a9e9cf0 100644 --- a/tool/src/commands/key.rs +++ b/tool/src/commands/key.rs @@ -41,7 +41,7 @@ pub fn generate(m: &ArgMatches, force: bool) -> failure::Fallible<()> { match m.value_of("expiry") { Some(expiry) if expiry == "never" => - builder = builder.set_expiration(None), + builder = builder.set_expiration_time(None), Some(expiry) => { let mut expiry = expiry.chars().peekable(); @@ -102,13 +102,13 @@ pub fn generate(m: &ArgMatches, force: bool) -> failure::Fallible<()> { junk, count, factor)); } - builder = builder.set_expiration( + builder = builder.set_expiration_time( Some(std::time::Duration::new(even_off(count * factor), 0))); } // Not specified. Use the default. None => { - builder = builder.set_expiration( + builder = builder.set_expiration_time( Some(std::time::Duration::new(even_off(3 * SECONDS_IN_YEAR), 0)) ); } -- cgit v1.2.3