- small cosmetic changes

This commit is contained in:
w.pomp
2026-07-22 13:40:27 +02:00
parent 0d347b7967
commit a5ec4125f9
5 changed files with 13 additions and 11 deletions
+1
View File
@@ -27,6 +27,7 @@ use pyo3_stub_gen::{StubGenConfig, StubInfo};
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
use std::error::Error as StdError;
use std::fmt::Debug;
use std::path::PathBuf;
fn format_error_chain(err: &crate::error::Error) -> String {
+5 -5
View File
@@ -470,15 +470,15 @@ impl Drop for BioFormatsJavaReader {
}
}
fn find_tiff(path: PathBuf) -> Result<Option<PathBuf>, Error> {
fn find_tiff(path: &Path) -> Result<Option<PathBuf>, Error> {
if let Some(ext) = path.extension()
&& path.is_file()
&& (["tif", "tiff"].contains(&ext.to_string_lossy().to_lowercase().as_str()))
{
return Ok(Some(path));
return Ok(Some(path.to_path_buf()));
} else if path.is_dir() {
for file in path.read_dir()?.flatten().sorted_by_key(|i| i.file_name()) {
if let Ok(Some(file)) = find_tiff(file.path()) {
if let Ok(Some(file)) = find_tiff(file.path().as_path()) {
return Ok(Some(file));
}
}
@@ -495,7 +495,7 @@ impl Reader for BioFormatsJavaReader {
let mut path = path.as_ref().to_path_buf();
if path.is_dir() {
let orig = path.clone();
path = find_tiff(path)?.ok_or_else(|| {
path = find_tiff(&path)?.ok_or_else(|| {
Error::FileDoesNotExist(orig.join("**").join("*.tif").display().to_string())
})?;
}
@@ -572,7 +572,7 @@ impl Reader for BioFormatsJavaReader {
let mut path = path.as_ref().to_path_buf();
if path.is_dir() {
let orig = path.clone();
path = find_tiff(path)?.ok_or_else(|| {
path = find_tiff(&path)?.ok_or_else(|| {
Error::FileDoesNotExist(orig.join("**").join("*.tif").display().to_string())
})?;
}
+2 -2
View File
@@ -795,7 +795,7 @@ impl Reader for CziReader {
.get_child("Wavelength")
.and_then(|w| w.get_text())
.and_then(|t| t.parse().ok())
.and_then(|w| if w > 0.0 { Some(w) } else { None }),
.filter(|&w| w > 0.0),
wavelength_unit: ome::UnitsLength::nm,
})
} else if let Version::Other = version {
@@ -876,7 +876,7 @@ impl Reader for CziReader {
.get_child("EmissionWaveLength")
.and_then(|e| e.get_text())
.and_then(|t| t.parse().ok())
.and_then(|w| if w > 0.0 { Some(w) } else { None }),
.filter(|&w| w > 0.0),
emission_wavelength_unit: ome::UnitsLength::nm,
excitation_wavelength: light_source_settings
.as_ref()