From 9a537fce290a9f6e536d3703bfb6b4ee082cf281 Mon Sep 17 00:00:00 2001 From: David Hotham Date: Fri, 24 May 2024 18:55:53 +0100 Subject: [PATCH] clippy --- src/channel.rs | 6 +++--- src/lib.rs | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/channel.rs b/src/channel.rs index 2bd7e819d..9d32d99b8 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -350,19 +350,19 @@ impl Channel { options.ares_options.ndomains = domains.len() as c_int; // Likewise for lookups. - for c_lookup in &options.lookups { + if let Some(c_lookup) = &options.lookups { options.ares_options.lookups = c_lookup.as_ptr().cast_mut() } // And the resolvconf_path. #[cfg(cares1_15)] - for c_resolvconf_path in &options.resolvconf_path { + if let Some(c_resolvconf_path) = &options.resolvconf_path { options.ares_options.resolvconf_path = c_resolvconf_path.as_ptr().cast_mut() } // And the hosts_path. #[cfg(cares1_19)] - for c_hosts_path in &options.hosts_path { + if let Some(c_hosts_path) = &options.hosts_path { options.ares_options.hosts_path = c_hosts_path.as_ptr().cast_mut() } diff --git a/src/lib.rs b/src/lib.rs index bfd704b33..6f2545f6c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,22 +14,22 @@ //! - Create a `Channel`. //! //! - Make queries on the `Channel`. Queries all take callbacks, which will be called when the -//! query completes. +//! query completes. //! //! - Have `c-ares` tell you what file descriptors to listen on for read and / or write events. -//! You can do this either by providing a callback, which is called whenever the set of interesting -//! file descriptors changes, or by querying the `Channel` directly either with `get_sock()` or -//! with `fds()`. +//! You can do this either by providing a callback, which is called whenever the set of +//! interesting file descriptors changes, or by querying the `Channel` directly either with +//! `get_sock()` or with `fds()`. //! //! - Do as `c-ares` asks. That is, listen for the events that it requests, on the file -//! descriptors that it cares about. +//! descriptors that it cares about. //! //! - When a file descriptor becomes readable or writable, call either `process_fd()` or -//! `process()` on the `Channel` to tell `c-ares` what has happened. +//! `process()` on the `Channel` to tell `c-ares` what has happened. //! //! - If you have queries pending and don't see events happening, you still need to call either -//! `process_fd()` or `process()` at some point anyway - to give `c-ares` an opportunity to process -//! any requests that have timed out. +//! `process_fd()` or `process()` at some point anyway - to give `c-ares` an opportunity to +//! process any requests that have timed out. //! //! Complete examples showing how to use the library can be found //! [here](https://github.com/dimbleby/rust-c-ares/tree/main/examples).