Skip to content

Commit e10b5d3

Browse files
committed
chore: address compiler warnings on nightly
- unwanted_transmutes on bindgen output - clippy::io_other_error - clippy::ptr_eq - clippy::uninlined_format_args
1 parent 8b6e925 commit e10b5d3

File tree

4 files changed

+19
-25
lines changed

4 files changed

+19
-25
lines changed

build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fn main() {
1717
println!("cargo::rerun-if-env-changed=DEP_NGINX_FEATURES");
1818
if let Ok(features) = std::env::var("DEP_NGINX_FEATURES") {
1919
for feature in features.split(',').map(str::trim) {
20-
println!("cargo::rustc-cfg=ngx_feature=\"{}\"", feature);
20+
println!("cargo::rustc-cfg=ngx_feature=\"{feature}\"");
2121
}
2222
}
2323

@@ -30,7 +30,7 @@ fn main() {
3030
// Read operating system detected by nginx-sys and pass to the compiler.
3131
println!("cargo::rerun-if-env-changed=DEP_NGINX_OS");
3232
if let Ok(os) = std::env::var("DEP_NGINX_OS") {
33-
println!("cargo::rustc-cfg=ngx_os=\"{}\"", os);
33+
println!("cargo::rustc-cfg=ngx_os=\"{os}\"");
3434
}
3535

3636
// Generate cfg values for version checks

nginx-sys/build/vendored.rs

+13-21
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,9 @@ fn download(cache_dir: &Path, url: &str) -> Result<PathBuf, Box<dyn StdError>> {
395395
}
396396

397397
if !file_path.exists() {
398-
return Err(format!(
399-
"Downloaded file was not written to the expected location: {}",
400-
url
401-
)
402-
.into());
398+
return Err(
399+
format!("Downloaded file was not written to the expected location: {url}",).into(),
400+
);
403401
}
404402
Ok(file_path)
405403
}
@@ -425,14 +423,11 @@ fn verify_signature_file(cache_dir: &Path, signature_path: &Path) -> Result<(),
425423

426424
if !output.status.success() {
427425
eprintln!("{}", String::from_utf8_lossy(&output.stdout));
428-
return Err(Box::new(std::io::Error::new(
429-
std::io::ErrorKind::Other,
430-
format!(
431-
"Command: {:?} \nGPG signature file verification failed for signature: {}",
432-
cmd,
433-
signature_path.display()
434-
),
435-
)));
426+
return Err(Box::new(std::io::Error::other(format!(
427+
"Command: {:?} \nGPG signature file verification failed for signature: {}",
428+
cmd,
429+
signature_path.display()
430+
))));
436431
}
437432
} else {
438433
println!("GPG not found, skipping signature file verification");
@@ -460,14 +455,11 @@ fn verify_archive_signature(
460455
let output = cmd.stderr_to_stdout().stdout_capture().unchecked().run()?;
461456
if !output.status.success() {
462457
eprintln!("{}", String::from_utf8_lossy(&output.stdout));
463-
return Err(Box::new(std::io::Error::new(
464-
std::io::ErrorKind::Other,
465-
format!(
466-
"Command: {:?}\nGPG signature verification failed of archive failed [{}]",
467-
cmd,
468-
archive_path.display()
469-
),
470-
)));
458+
return Err(Box::new(std::io::Error::other(format!(
459+
"Command: {:?}\nGPG signature verification failed of archive failed [{}]",
460+
cmd,
461+
archive_path.display()
462+
))));
471463
}
472464
} else {
473465
println!("GPG not found, skipping signature verification");

nginx-sys/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use core::slice;
1212

1313
#[doc(hidden)]
1414
mod bindings {
15+
#![allow(unknown_lints)] // unnecessary_transmutes
1516
#![allow(missing_docs)]
1617
#![allow(non_upper_case_globals)]
1718
#![allow(non_camel_case_types)]
@@ -20,6 +21,7 @@ mod bindings {
2021
#![allow(clippy::all)]
2122
#![allow(improper_ctypes)]
2223
#![allow(rustdoc::broken_intra_doc_links)]
24+
#![allow(unnecessary_transmutes)]
2325
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
2426
}
2527
#[doc(no_inline)]

nginx-sys/src/queue.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub unsafe fn ngx_queue_init(q: *mut ngx_queue_t) {
3434
/// `q` must be a valid pointer to [ngx_queue_t], initialized with [ngx_queue_init].
3535
#[inline]
3636
pub unsafe fn ngx_queue_empty(q: *const ngx_queue_t) -> bool {
37-
q == (*q).prev
37+
ptr::eq(q, (*q).prev)
3838
}
3939

4040
/// Inserts a new node after the current.
@@ -190,7 +190,7 @@ mod tests {
190190
type Item = *mut ngx_queue_t;
191191

192192
fn next(&mut self) -> Option<Self::Item> {
193-
if self.h == self.q {
193+
if ptr::eq(self.h, self.q) {
194194
return None;
195195
}
196196

0 commit comments

Comments
 (0)