Skip to content

Commit

Permalink
Fix new clippy warnings for rustc 1.73
Browse files Browse the repository at this point in the history
  • Loading branch information
Luthaf committed Oct 6, 2023
1 parent 55ad1f1 commit 45251d6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions rascaline-c-api/src/calculator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@ pub unsafe extern fn rascal_calculator(name: *const c_char, parameters: *const c
let mut raw = std::ptr::null_mut();
let unwind_wrapper = std::panic::AssertUnwindSafe(&mut raw);
let status = catch_unwind(move || {
let unwind_wrapper = unwind_wrapper;

check_pointers!(name, parameters);
let name = CStr::from_ptr(name).to_str()?;
let parameters = CStr::from_ptr(parameters).to_str()?;
let calculator = Calculator::new(name, parameters.to_owned())?;
let boxed = Box::new(rascal_calculator_t(calculator));

let _ = &unwind_wrapper;
*unwind_wrapper.0 = Box::into_raw(boxed);
Ok(())
});
Expand Down
2 changes: 1 addition & 1 deletion rascaline-c-api/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl From<Error> for rascal_status_t {
/// the error into `rascal_status_t`.
pub fn catch_unwind<F>(function: F) -> rascal_status_t where F: FnOnce() -> Result<(), Error> + UnwindSafe {
match std::panic::catch_unwind(function) {
Ok(Ok(_)) => rascal_status_t(RASCAL_SUCCESS),
Ok(Ok(())) => rascal_status_t(RASCAL_SUCCESS),
Ok(Err(error)) => error.into(),
Err(error) => Error::from(error).into()
}
Expand Down
2 changes: 1 addition & 1 deletion rascaline/src/calculators/neighbor_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ impl FullNeighborList {
system.compute_neighbors(self.cutoff)?;
let species = system.species()?;

for pair in system.pairs()?.iter() {
for pair in system.pairs()? {
let first_block_i = descriptor.keys().position(&[
species[pair.first].into(), species[pair.second].into()
]);
Expand Down
4 changes: 2 additions & 2 deletions rascaline/src/calculators/soap/spherical_expansion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl SphericalExpansion {
let neighbor_i = pair.second;

result.pair_to_pair_ids.entry((pair.first, pair.second))
.or_insert_with(Vec::new)
.or_default()
.push(pair_id);

let species_neighbor_i = result.species_mapping[&species[neighbor_i]];
Expand Down Expand Up @@ -253,7 +253,7 @@ impl SphericalExpansion {
let neighbor_i = pair.first;

result.pair_to_pair_ids.entry((pair.second, pair.first))
.or_insert_with(Vec::new)
.or_default()
.push(pair_id);


Expand Down

0 comments on commit 45251d6

Please sign in to comment.