Skip to content

Commit e7d263f

Browse files
committed
Minor clippy lints
1 parent c45b716 commit e7d263f

File tree

7 files changed

+9
-16
lines changed

7 files changed

+9
-16
lines changed

hdf5-src/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn main() {
4141
let zlib_lib = "z";
4242
cfg.define("HDF5_ENABLE_Z_LIB_SUPPORT", "ON")
4343
.define("H5_ZLIB_HEADER", &zlib_header)
44-
.define("ZLIB_STATIC_LIBRARY", &zlib_lib);
44+
.define("ZLIB_STATIC_LIBRARY", zlib_lib);
4545
println!("cargo:zlib_header={}", zlib_header.to_str().unwrap());
4646
println!("cargo:zlib={}", zlib_lib);
4747
}

hdf5-sys/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ impl LibrarySearcher {
565565
}
566566
}
567567
}
568-
let header = Header::parse(&inc_dir);
568+
let header = Header::parse(inc_dir);
569569
if let Some(version) = self.version {
570570
assert_eq!(header.version, version, "HDF5 header version mismatch",);
571571
}

src/hl/file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl ObjectClass for File {
5050
fn short_repr(&self) -> Option<String> {
5151
let basename = match Path::new(&self.filename()).file_name() {
5252
Some(s) => s.to_string_lossy().into_owned(),
53-
None => "".to_owned(),
53+
None => String::new(),
5454
};
5555
let mode = if self.is_read_only() { "read-only" } else { "read/write" };
5656
Some(format!("\"{}\" ({})", basename, mode))

src/hl/location.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ impl Location {
7070
/// have a name (e.g., an anonymous dataset).
7171
pub fn name(&self) -> String {
7272
// TODO: should this return Result<String> or an empty string if it fails?
73-
h5lock!(get_h5_str(|m, s| H5Iget_name(self.id(), m, s)).unwrap_or_else(|_| "".to_string()))
73+
h5lock!(get_h5_str(|m, s| H5Iget_name(self.id(), m, s)).unwrap_or_else(|_| String::new()))
7474
}
7575

7676
/// Returns the name of the file containing the named object (or the file itself).
7777
pub fn filename(&self) -> String {
7878
// TODO: should this return Result<String> or an empty string if it fails?
79-
h5lock!(get_h5_str(|m, s| H5Fget_name(self.id(), m, s)).unwrap_or_else(|_| "".to_string()))
79+
h5lock!(get_h5_str(|m, s| H5Fget_name(self.id(), m, s)).unwrap_or_else(|_| String::new()))
8080
}
8181

8282
/// Returns a handle to the file containing the named object (or the file itself).

src/hl/plist/dataset_access.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ impl DatasetAccess {
271271

272272
#[cfg(feature = "1.8.17")]
273273
pub fn efile_prefix(&self) -> String {
274-
self.get_efile_prefix().ok().unwrap_or_else(|| "".into())
274+
self.get_efile_prefix().ok().unwrap_or_default()
275275
}
276276

277277
#[cfg(feature = "1.10.0")]

src/hl/plist/file_access.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ impl Default for MetadataCacheConfig {
702702
rpt_fcn_enabled: false,
703703
open_trace_file: false,
704704
close_trace_file: false,
705-
trace_file_name: "".into(),
705+
trace_file_name: String::new(),
706706
evictions_enabled: true,
707707
set_initial_size: true,
708708
initial_size: 1 << 21,
@@ -857,20 +857,13 @@ mod cache_image_config {
857857
pub use self::cache_image_config::*;
858858

859859
#[cfg(feature = "1.10.0")]
860-
#[derive(Clone, Debug, PartialEq, Eq)]
860+
#[derive(Clone, Debug, Default, PartialEq, Eq)]
861861
pub struct CacheLogOptions {
862862
pub is_enabled: bool,
863863
pub location: String,
864864
pub start_on_access: bool,
865865
}
866866

867-
#[cfg(feature = "1.10.0")]
868-
impl Default for CacheLogOptions {
869-
fn default() -> Self {
870-
Self { is_enabled: false, location: "".into(), start_on_access: false }
871-
}
872-
}
873-
874867
#[cfg(feature = "1.10.2")]
875868
mod libver {
876869
use super::*;

src/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ where
6363
let len = 1_isize + (func(ptr::null_mut(), 0)).try_into().unwrap_or(-1);
6464
ensure!(len > 0, "negative string length in get_h5_str()");
6565
if len == 1 {
66-
Ok("".to_owned())
66+
Ok(String::new())
6767
} else {
6868
let mut buf = vec![0; len as usize];
6969
func(buf.as_mut_ptr(), len as _);

0 commit comments

Comments
 (0)