From a1b372ed2eb9e78b3d996b4a0763b6b28e4e7744 Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Mon, 17 Jun 2024 20:24:23 +0200 Subject: [PATCH 1/2] Remove duplicated attribute --- netcdf-sys/src/mmap.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/netcdf-sys/src/mmap.rs b/netcdf-sys/src/mmap.rs index 5d8cbeb..b87bd5d 100644 --- a/netcdf-sys/src/mmap.rs +++ b/netcdf-sys/src/mmap.rs @@ -1,10 +1,8 @@ -#![cfg(feature = "has-mmap")] - use std::os::raw::{c_char, c_int, c_void}; #[repr(C)] #[derive(Copy, Clone)] -#[cfg(all(feature = "has-mmap", feature = "1.6.2"))] +#[cfg(feature = "1.6.2")] pub struct NC_memio { size: usize, memory: *mut c_void, @@ -12,7 +10,6 @@ pub struct NC_memio { } extern "C" { - #[cfg(feature = "has-mmap")] pub fn nc_open_mem( path: *const c_char, mode: c_int, @@ -21,14 +18,14 @@ extern "C" { ncidp: *mut c_int, ) -> c_int; - #[cfg(all(feature = "has-mmap", feature = "1.6.2"))] + #[cfg(feature = "1.6.2")] pub fn nc_create_mem( path: *const c_char, mode: c_int, initialsize: usize, ncidp: *mut c_int, ) -> c_int; - #[cfg(all(feature = "has-mmap", feature = "1.6.2"))] + #[cfg(feature = "1.6.2")] pub fn nc_open_memio( path: *const c_char, mode: c_int, @@ -36,6 +33,6 @@ extern "C" { ncidp: *mut c_int, ) -> c_int; - #[cfg(all(feature = "has-mmap", feature = "1.6.2"))] + #[cfg(feature = "1.6.2")] pub fn nc_close_memio(ncid: c_int, info: *mut NC_memio) -> c_int; } From 6fa28afa9c9e9a084707ded6bc4d64bd84d27e6d Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Mon, 17 Jun 2024 20:27:40 +0200 Subject: [PATCH 2/2] Replace legacy numeric constant --- netcdf/src/variable.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netcdf/src/variable.rs b/netcdf/src/variable.rs index fc8af9d..9103780 100644 --- a/netcdf/src/variable.rs +++ b/netcdf/src/variable.rs @@ -244,7 +244,7 @@ impl<'g> VariableMut<'g> { .iter() .copied() .fold(1_usize, usize::saturating_mul); - if len == usize::max_value() { + if len == usize::MAX { return Err(error::Error::Overflow); } unsafe {