Skip to content

Commit

Permalink
code changes suggested by cargo clippy
Browse files Browse the repository at this point in the history
- skip doc comment suggestions
  • Loading branch information
alexander-buerger-met-no committed Aug 14, 2024
1 parent 5215b59 commit 338441f
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions dap2/src/dds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,15 @@ impl Dds {
file_name: self.file_name.clone(),
variables: self
.variables
.iter()
.map(|(_, var)| {
.values()
.map(|var| {
// If not all dimensions have corresponding variables, return as variable and
// not a gridded variable.
if var.dimensions.len() > 1
&& var
.dimensions
.iter()
.all(|d| self.variables.get(d).is_some())
.all(|d| self.variables.contains_key(d))
{
ConstrainedVariable::Grid {
variable: DdsVariableDetails {
Expand Down Expand Up @@ -320,7 +320,7 @@ impl Dds {
&& var
.dimensions
.iter()
.all(|d| self.variables.get(d).is_some())
.all(|d| self.variables.contains_key(d))
{
Ok(ConstrainedVariable::Grid {
variable: DdsVariableDetails {
Expand Down
4 changes: 2 additions & 2 deletions dap2/src/dods/xdr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn xdr_serialize(v: &DdsVariableDetails, b: Bytes) -> Bytes {

match v.vartype {
UInt16 => {
let b: &[u8] = &*b;
let b: &[u8] = &b;
let u: &[u16] = bytemuck::cast_slice(b);

u.iter()
Expand All @@ -38,7 +38,7 @@ pub fn xdr_serialize(v: &DdsVariableDetails, b: Bytes) -> Bytes {
.collect()
}
Int16 => {
let b: &[u8] = &*b;
let b: &[u8] = &b;
let u: &[i16] = bytemuck::cast_slice(b);

u.iter()
Expand Down
2 changes: 1 addition & 1 deletion dars/src/hdf5/das.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ fn h5attr_to_das(n: &str, a: hdf5::Attribute) -> das::Attribute {
h5t::Integer(IntSize::U4) => Int(a.read_scalar().unwrap()),
h5t::Float(FloatSize::U4) => Float(a.read_scalar().unwrap()),
h5t::Float(FloatSize::U8) => Double(a.read_scalar().unwrap()),
h5t::FixedAscii(n) => fixedascii_to_string(&*a).map(Str).unwrap_or_else(|_| {
h5t::FixedAscii(n) => fixedascii_to_string(&a).map(Str).unwrap_or_else(|_| {
Unimplemented(format!("(fixed ascii) unsupported: {:?}", n))
}),
dtype => Unimplemented(format!("(scalar) {:?}", dtype)),
Expand Down
2 changes: 1 addition & 1 deletion dars/src/hdf5/dds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub(crate) fn hdf5_dimensions(m: &str, dataset: &hdf5::Dataset) -> Vec<String> {

let name = std::str::from_utf8(&name[..name.len() - 2]).unwrap();

dims.push((&name[1..]).to_owned()); // remove leading '/'
dims.push(name[1..].to_owned()); // remove leading '/'

hs::h5d::H5Dclose(dset);
}
Expand Down
4 changes: 2 additions & 2 deletions dars/src/hdf5/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ impl Hdf5Dataset {
) -> anyhow::Result<Hdf5Dataset> {
let path = path.as_ref();

let modified = std::fs::metadata(&path)?.modified()?;
let modified = std::fs::metadata(path)?.modified()?;

let hf = HDF5File(hdf5::File::open(&path)?, key);
let hf = HDF5File(hdf5::File::open(path)?, key);

trace!("Building DAS of {:?}..", path);
let das = (&hf).into();
Expand Down
4 changes: 2 additions & 2 deletions dars/src/ncml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl NcmlDataset {
info!("Loading {:?}..", path);

// Parse NCML file.
let xml = std::fs::read_to_string(&path)?;
let xml = std::fs::read_to_string(path)?;
let xml = roxmltree::Document::parse(&xml)?;
let root = xml.root_element();

Expand Down Expand Up @@ -260,7 +260,7 @@ impl dap2::DodsXdr for NcmlDataset {
.boxed()
} else if variable
.dimensions
.get(0)
.first()
.map(|d| d.0 != self.dimension)
.unwrap_or(true)
{
Expand Down

0 comments on commit 338441f

Please sign in to comment.