Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/interactive-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Configure Rust
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: 1.96.1
toolchain: 1.97.0
targets: wasm32-unknown-unknown
- name: Check rust installation
run: rustc -vV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
- name: Configure Rust
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: 1.96.1
toolchain: 1.97.0
- name: Authorize with crates.io
uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18 # v1.0.5
id: auth
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
permissions: {}

env:
CARGO_BUILD_WARNINGS: deny
CARGO_TERM_COLOR: always
CLICOLOR: 1

Expand All @@ -33,7 +34,7 @@ jobs:
- name: Configure Rust
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: 1.96.1
toolchain: 1.97.0
targets: wasm32-unknown-unknown
components: clippy
- name: Cache
Expand All @@ -43,10 +44,6 @@ jobs:
cache-bin: false
save-if: ${{ github.ref != 'refs/heads/trunk' }}

# Unfortunately, it is not currently possible to mark warnings as errors with cargo check:
# https://github.com/rust-lang/cargo/issues/8424#issuecomment-1915265827
# The workaround does not work for hoomd-rs because we set rust configuration options.
#
# Check all targets in debug and release modes
- name: cargo check [native]
run: >
Expand All @@ -56,6 +53,7 @@ jobs:
--workspace
--all-targets
--all-features
--keep-going

- name: cargo clippy [native]
run: >
Expand All @@ -65,7 +63,7 @@ jobs:
--workspace
--all-targets
--all-features
-- -Dwarnings
--keep-going

# Check the examples in wasm builds with and without webgpu
- name: cargo check [wasm32, features="bevy"]
Expand All @@ -78,6 +76,8 @@ jobs:
--lib
--examples
--target wasm32-unknown-unknown
--keep-going

- name: cargo check [wasm32, features="bevy,webgpu"]
run: >
cargo check
Expand All @@ -88,6 +88,7 @@ jobs:
--lib
--examples
--target wasm32-unknown-unknown
--keep-going

- name: cargo clippy [wasm32, features="bevy"]
run: >
Expand All @@ -99,7 +100,8 @@ jobs:
--lib
--examples
--target wasm32-unknown-unknown
-- -Dwarnings
--keep-going

- name: cargo clippy [wasm32, features="bevy,webgpu"]
run: >
cargo clippy
Expand All @@ -110,7 +112,7 @@ jobs:
--lib
--examples
--target wasm32-unknown-unknown
-- -Dwarnings
--keep-going

cargo-fmt:
runs-on: ubuntu-24.04
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Configure Rust
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9
with:
toolchain: 1.96.1
toolchain: 1.97.0
targets: ${{ matrix.target }}
- name: Check rust installation
run: rustc -vV
Expand Down
9 changes: 3 additions & 6 deletions hoomd-gsd/src/file_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ impl GsdFile {
fn get_index(&self, i: u64) -> Result<IndexEntry, DecodeError> {
// get_index is an internal method, assume that any caller has already
// called remap() if needed. Verify this in debug builds.
debug_assert!(self.mmap.len() as u64 == self.file_len);
debug_assert_eq!(self.mmap.len() as u64, self.file_len);

let start = self.header.index_location + i * INDEX_ENTRY_SIZE;
let end = start + INDEX_ENTRY_SIZE;
Expand Down Expand Up @@ -1439,10 +1439,7 @@ impl GsdFile {
return None;
}

let id = match self.name_list.name_id.get(name) {
None => return None,
Some(id) => *id,
};
let id = self.name_list.name_id.get(name)?;

// binary search for the index entry
let mut l: u64 = 0;
Expand All @@ -1454,7 +1451,7 @@ impl GsdFile {
// We can map an error to None here because the unaddressable index error
// would have previously been caught on open or sync.
if let Ok(index_entry_m) = self.get_index(m) {
match (index_entry_m.frame, index_entry_m.id).cmp(&(frame, id)) {
match (index_entry_m.frame, index_entry_m.id).cmp(&(frame, *id)) {
Ordering::Less => l = m + 1,
Ordering::Greater => r = m - 1,
Ordering::Equal => return Some(index_entry_m),
Expand Down
8 changes: 4 additions & 4 deletions hoomd-manifold/src/biquaternion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,10 +852,10 @@ mod tests {
Complex::new(1.0, 0.0),
Complex::new(1.0, 0.0),
]);
assert!(q.components[0] == Complex::new(-1.0, 0.0));
assert!(q.components[1] == Complex::new(0.0, 1.0));
assert!(q.components[2] == Complex::new(1.0, 0.0));
assert!(q.components[3] == Complex::new(1.0, 0.0));
assert_eq!(q.components[0], Complex::new(-1.0, 0.0));
assert_eq!(q.components[1], Complex::new(0.0, 1.0));
assert_eq!(q.components[2], Complex::new(1.0, 0.0));
assert_eq!(q.components[3], Complex::new(1.0, 0.0));
}

#[test]
Expand Down
2 changes: 1 addition & 1 deletion hoomd-mc/src/parallel_sweep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl<L, K, B, S> ParallelSweep<L, K, B, S> {
self.spaces
.resize_with(self.checkerboard.num_spaces(), Vec::default);
for space in &mut self.spaces {
space.truncate(0);
space.clear();
}
for (body_index, body) in microstate.bodies().iter().enumerate() {
let space_index = self
Expand Down
52 changes: 26 additions & 26 deletions hoomd-microstate/src/append.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ mod test {

let gsd_file = GsdFile::open(path, Mode::Read)?;

assert!(gsd_file.n_frames() == 1);
assert_eq!(gsd_file.n_frames(), 1);

let step = gsd_file.iter_scalars::<u64>(0, "configuration/step")?;
itertools::assert_equal(step, [1234]);
Expand Down Expand Up @@ -364,7 +364,7 @@ mod test {

let gsd_file = GsdFile::open(path, Mode::Read)?;

assert!(gsd_file.n_frames() == 1);
assert_eq!(gsd_file.n_frames(), 1);

let step = gsd_file.iter_scalars::<u64>(0, "configuration/step")?;
itertools::assert_equal(step, [1234]);
Expand Down Expand Up @@ -412,7 +412,7 @@ mod test {

let gsd_file = GsdFile::open(path, Mode::Read)?;

assert!(gsd_file.n_frames() == 1);
assert_eq!(gsd_file.n_frames(), 1);

let step = gsd_file.iter_scalars::<u64>(0, "configuration/step")?;
itertools::assert_equal(step, [1234]);
Expand Down Expand Up @@ -465,7 +465,7 @@ mod test {

let gsd_file = GsdFile::open(path, Mode::Read)?;

assert!(gsd_file.n_frames() == 1);
assert_eq!(gsd_file.n_frames(), 1);

let step = gsd_file.iter_scalars::<u64>(0, "configuration/step")?;
itertools::assert_equal(step, [1234]);
Expand Down Expand Up @@ -505,7 +505,7 @@ mod test {

let gsd_file = GsdFile::open(path, Mode::Read)?;

assert!(gsd_file.n_frames() == 1);
assert_eq!(gsd_file.n_frames(), 1);

let step = gsd_file.iter_scalars::<u64>(0, "configuration/step")?;
itertools::assert_equal(step, [1234]);
Expand Down Expand Up @@ -547,7 +547,7 @@ mod test {

let gsd_file = GsdFile::open(path, Mode::Read)?;

assert!(gsd_file.n_frames() == 1);
assert_eq!(gsd_file.n_frames(), 1);

let step = gsd_file.iter_scalars::<u64>(0, "configuration/step")?;
itertools::assert_equal(step, [1234]);
Expand Down Expand Up @@ -612,7 +612,7 @@ mod test {

let gsd_file = GsdFile::open(path, Mode::Read)?;

assert!(gsd_file.n_frames() == 1);
assert_eq!(gsd_file.n_frames(), 1);

let step = gsd_file.iter_scalars::<u64>(0, "configuration/step")?;
itertools::assert_equal(step, [1234]);
Expand Down Expand Up @@ -678,7 +678,7 @@ mod test {

let gsd_file = GsdFile::open(path, Mode::Read)?;

assert!(gsd_file.n_frames() == 1);
assert_eq!(gsd_file.n_frames(), 1);

let step = gsd_file.iter_scalars::<u64>(0, "configuration/step")?;
itertools::assert_equal(step, [1234]);
Expand Down Expand Up @@ -747,19 +747,19 @@ mod test {

let gsd_file = GsdFile::open(path, Mode::Read)?;

assert!(gsd_file.n_frames() == 1);
assert_eq!(gsd_file.n_frames(), 1);

let step = gsd_file.iter_scalars::<u64>(0, "configuration/step")?;
itertools::assert_equal(step, [1234]);

let positions = gsd_file.iter_arrays::<f32, 3>(0, "particles/position")?;
itertools::assert_equal(positions, [[1.0, 0.0, 0.0], [-1.0, 2.0, 0.0]]);

assert!(
assert_eq!(
gsd_file
.iter_arrays::<f32, 4>(0, "particles/orientation")?
.count()
== 2
.count(),
2
);

let dimensions = gsd_file.iter_scalars::<u8>(0, "configuration/dimensions")?;
Expand Down Expand Up @@ -816,19 +816,19 @@ mod test {

let gsd_file = GsdFile::open(path, Mode::Read)?;

assert!(gsd_file.n_frames() == 1);
assert_eq!(gsd_file.n_frames(), 1);

let step = gsd_file.iter_scalars::<u64>(0, "configuration/step")?;
itertools::assert_equal(step, [1234]);

let positions = gsd_file.iter_arrays::<f32, 3>(0, "particles/position")?;
itertools::assert_equal(positions, [[1.0, 0.0, 0.0], [-1.0, 2.0, 0.0]]);

assert!(
assert_eq!(
gsd_file
.iter_arrays::<f32, 4>(0, "particles/orientation")?
.count()
== 2
.count(),
2
);

let dimensions = gsd_file.iter_scalars::<u8>(0, "configuration/dimensions")?;
Expand Down Expand Up @@ -864,7 +864,7 @@ mod test {

let gsd_file = GsdFile::open(path, Mode::Read)?;

assert!(gsd_file.n_frames() == 1);
assert_eq!(gsd_file.n_frames(), 1);

let step = gsd_file.iter_scalars::<u64>(0, "configuration/step")?;
itertools::assert_equal(step, [1234]);
Expand Down Expand Up @@ -908,7 +908,7 @@ mod test {

let gsd_file = GsdFile::open(path, Mode::Read)?;

assert!(gsd_file.n_frames() == 1);
assert_eq!(gsd_file.n_frames(), 1);

let step = gsd_file.iter_scalars::<u64>(0, "configuration/step")?;
itertools::assert_equal(step, [1234]);
Expand Down Expand Up @@ -967,19 +967,19 @@ mod test {

let gsd_file = GsdFile::open(path, Mode::Read)?;

assert!(gsd_file.n_frames() == 1);
assert_eq!(gsd_file.n_frames(), 1);

let step = gsd_file.iter_scalars::<u64>(0, "configuration/step")?;
itertools::assert_equal(step, [1234]);

let positions = gsd_file.iter_arrays::<f32, 3>(0, "particles/position")?;
itertools::assert_equal(positions, [[1.0, 0.0, 4.0], [-1.0, 2.0, -2.0]]);

assert!(
assert_eq!(
gsd_file
.iter_arrays::<f32, 4>(0, "particles/orientation")?
.count()
== 2
.count(),
2
);

let dimensions = gsd_file.iter_scalars::<u8>(0, "configuration/dimensions")?;
Expand Down Expand Up @@ -1036,19 +1036,19 @@ mod test {

let gsd_file = GsdFile::open(path, Mode::Read)?;

assert!(gsd_file.n_frames() == 1);
assert_eq!(gsd_file.n_frames(), 1);

let step = gsd_file.iter_scalars::<u64>(0, "configuration/step")?;
itertools::assert_equal(step, [1234]);

let positions = gsd_file.iter_arrays::<f32, 3>(0, "particles/position")?;
itertools::assert_equal(positions, [[1.0, 0.0, 4.0], [-1.0, 2.0, -2.0]]);

assert!(
assert_eq!(
gsd_file
.iter_arrays::<f32, 4>(0, "particles/orientation")?
.count()
== 2
.count(),
2
);

let dimensions = gsd_file.iter_scalars::<u8>(0, "configuration/dimensions")?;
Expand Down
Loading