From 98dc2a4579c9657003f0de740ec568e2eaa244da Mon Sep 17 00:00:00 2001 From: Asger Hautop Drewsen Date: Thu, 25 Jan 2024 16:09:56 +0100 Subject: [PATCH] Fix compiling with urlspec, but not tls feature --- amqprs/src/api/connection.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/amqprs/src/api/connection.rs b/amqprs/src/api/connection.rs index 2505535..51b6dae 100644 --- a/amqprs/src/api/connection.rs +++ b/amqprs/src/api/connection.rs @@ -521,10 +521,14 @@ impl TryFrom<&str> for OpenConnectionArguments { args.heartbeat(heartbeat); if scheme == AMQPS_SCHEME { + #[cfg(feature = "tls")] args.tls_adaptor( TlsAdaptor::without_client_auth(None, host.to_string()) - .map_err(|e| Error::UriError(format!("Error creating TLS adaptor: {}", e)))?, + .map_err(|e| Error::UriError(format!("error creating TLS adaptor: {}", e)))?, ); + + #[cfg(not(feature = "tls"))] + return Err(Error::UriError("can't create amqps url without the `tls` feature enabled".to_string())); } Ok(args)