1
0
mirror of https://github.com/pcvolkmer/cert-tools.git synced 2025-04-19 17:06:49 +00:00

refactor: change method name

This commit is contained in:
Paul-Christian Volkmer 2025-01-03 23:53:33 +01:00
parent b1fe6c0be5
commit 35e5de2632
2 changed files with 6 additions and 6 deletions

View File

@ -314,7 +314,7 @@ impl Chain {
&self.certs &self.certs
} }
pub fn to_vec(self) -> Vec<Certificate> { pub fn into_vec(self) -> Vec<Certificate> {
self.certs self.certs
} }

View File

@ -38,7 +38,7 @@ fn main() -> Result<(), ()> {
if let Ok(mut chain) = chain { if let Ok(mut chain) = chain {
if let Some(ca) = ca { if let Some(ca) = ca {
if let Ok(ca_chain) = Chain::read(Path::new(&ca)) { if let Ok(ca_chain) = Chain::read(Path::new(&ca)) {
for ca_cert in ca_chain.to_vec() { for ca_cert in ca_chain.into_vec() {
chain.push(ca_cert); chain.push(ca_cert);
} }
} else { } else {
@ -99,7 +99,7 @@ fn main() -> Result<(), ()> {
if let Ok(mut chain) = chain { if let Ok(mut chain) = chain {
if let Some(ca) = ca { if let Some(ca) = ca {
if let Ok(ca_chain) = Chain::read(Path::new(&ca)) { if let Ok(ca_chain) = Chain::read(Path::new(&ca)) {
for ca_cert in ca_chain.to_vec() { for ca_cert in ca_chain.into_vec() {
chain.push(ca_cert); chain.push(ca_cert);
} }
} else { } else {
@ -114,12 +114,12 @@ fn main() -> Result<(), ()> {
.yellow() .yellow()
); );
} }
let mut certs = chain.to_vec(); let mut certs = chain.into_vec();
certs.sort_by(|cert1, cert2| { certs.sort_by(|cert1, cert2| {
if cert1.subject_key_id() == cert2.authority_key_id() { if cert1.subject_key_id() == cert2.authority_key_id() {
return Ordering::Greater; Ordering::Greater
} else { } else {
return Ordering::Less; Ordering::Less
} }
}); });
let chain = Chain::from(certs.into_iter().unique().collect::<Vec<_>>()); let chain = Chain::from(certs.into_iter().unique().collect::<Vec<_>>());