mirror of
				https://github.com/pcvolkmer/cert-tools.git
				synced 2025-10-31 04:56:12 +00:00 
			
		
		
		
	refactor: change method name
This commit is contained in:
		| @@ -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 | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										10
									
								
								src/main.rs
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/main.rs
									
									
									
									
									
								
							| @@ -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<_>>()); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user