diff --git a/examples/mc_npt_argon.rs b/examples/mc_npt_argon.rs index 550d61a4a..40147b1e8 100644 --- a/examples/mc_npt_argon.rs +++ b/examples/mc_npt_argon.rs @@ -4,7 +4,6 @@ //! Testing physical properties of a Lennard-Jones Argon using Monte Carlo //! simulation. extern crate lumol; -extern crate lumol_input as input; use lumol::sys::{System, TrajectoryBuilder, UnitCell}; use lumol::energy::{LennardJones, PairInteraction}; diff --git a/examples/mc_npt_ethane.rs b/examples/mc_npt_ethane.rs index 6414b0851..72d11d5f5 100644 --- a/examples/mc_npt_ethane.rs +++ b/examples/mc_npt_ethane.rs @@ -1,7 +1,6 @@ // Lumol, an extensible molecular simulation engine // Copyright (C) Lumol's contributors — BSD license extern crate lumol; -extern crate lumol_input as input; use lumol::sys::{UnitCell, System, TrajectoryBuilder}; use lumol::units; @@ -91,7 +90,7 @@ fn main() { // (See frequencies of moves: // nmols/2 translations + nmols/2 rotations + 2 resize moves) let moves_per_cycle = 10; - let cycles = 100000; + let cycles = 100_000; // Some output and start of the simulation. println!("Simuation of 100 ethane molecules."); diff --git a/examples/mc_npt_spce.rs b/examples/mc_npt_spce.rs index 325b0e1a2..972aec6f5 100644 --- a/examples/mc_npt_spce.rs +++ b/examples/mc_npt_spce.rs @@ -1,7 +1,6 @@ // Lumol, an extensible molecular simulation engine // Copyright (C) Lumol's contributors — BSD license extern crate lumol; -extern crate lumol_input as input; use lumol::sys::{UnitCell, System, TrajectoryBuilder}; use lumol::units; @@ -102,14 +101,14 @@ fn main() { simulation.add_output_with_frequency( Box::new(EnergyOutput::new("npt_spce_ener.dat").unwrap()), 500); simulation.add_output_with_frequency( - Box::new(TrajectoryOutput::new("npt_spce_conf.xyz").unwrap()), 10000); + Box::new(TrajectoryOutput::new("npt_spce_conf.xyz").unwrap()), 10_000); // Often, a simulation is described using `MC cycles`. // We define a `cycle` to contain `nmols+2` moves. // (See frequencies of moves: // nmols/2 translations + nmols/2 rotations + 2 resize moves) let moves_per_cycle = 92; - let cycles = 10000; + let cycles = 10_000; // Some output and start of the simulation. println!("Simuation of 90 spce molecules."); diff --git a/examples/xenon.rs b/examples/xenon.rs index ecefe34bd..ac2de3f65 100644 --- a/examples/xenon.rs +++ b/examples/xenon.rs @@ -36,5 +36,5 @@ fn main() { let trajectory_out = Box::new(TrajectoryOutput::new("trajectory.xyz").unwrap()); simulation.add_output_with_frequency(trajectory_out, 50); - simulation.run(&mut system, 20000); + simulation.run(&mut system, 20_000); } diff --git a/src/bin/lumol.rs b/src/bin/lumol.rs index 8b65cf6ed..c9b6125ed 100644 --- a/src/bin/lumol.rs +++ b/src/bin/lumol.rs @@ -1,7 +1,5 @@ // Lumol, an extensible molecular simulation engine // Copyright (C) Lumol's contributors — BSD license - -extern crate lumol; extern crate lumol_input; #[macro_use] @@ -11,8 +9,6 @@ extern crate clap; use lumol_input::Input; use clap::{App, ArgMatches}; -use std::process::exit; - fn parse_args<'a>() -> ArgMatches<'a> { App::new("lumol") .version(env!("CARGO_PKG_VERSION")) @@ -28,7 +24,7 @@ fn main() { Ok(config) => config, Err(err) => { error!("bad input file: {}", err); - exit(2); + std::process::exit(2) } }; diff --git a/src/core/src/energy/global/wolf.rs b/src/core/src/energy/global/wolf.rs index 282633f3a..1db144a55 100644 --- a/src/core/src/energy/global/wolf.rs +++ b/src/core/src/energy/global/wolf.rs @@ -206,7 +206,7 @@ impl GlobalPotential for Wolf { let thread_forces_store = ThreadLocalStore::new(|| vec![Vector3D::zero(); natoms]); (0..natoms).into_par_iter().for_each(|i| { - /// Get the thread local forces Vec + // Get the thread local forces Vec let mut thread_forces = thread_forces_store.borrow_mut(); let qi = configuration.particle(i).charge; diff --git a/src/core/src/lib.rs b/src/core/src/lib.rs index 3129e55b0..4590cf61d 100644 --- a/src/core/src/lib.rs +++ b/src/core/src/lib.rs @@ -31,7 +31,7 @@ cast_possible_wrap, float_cmp, or_fun_call, string_add, non_ascii_literal, doc_markdown, missing_docs_in_private_items, module_inception, stutter, unseparated_literal_suffix, new_without_default, new_without_default_derive, - zero_ptr, + zero_ptr, use_self, borrowed_box )] #[macro_use] diff --git a/src/core/src/sim/simulations.rs b/src/core/src/sim/simulations.rs index d021fc61c..5a09ff3f5 100644 --- a/src/core/src/sim/simulations.rs +++ b/src/core/src/sim/simulations.rs @@ -84,7 +84,7 @@ impl Simulation { output.write(system); } - if i % 10000 == 0 { + if i % 10_000 == 0 { self.sanity_check(system); } } diff --git a/src/core/src/sys/config/molecules.rs b/src/core/src/sys/config/molecules.rs index d3884c5d5..7d0472560 100644 --- a/src/core/src/sys/config/molecules.rs +++ b/src/core/src/sys/config/molecules.rs @@ -116,7 +116,7 @@ impl Molecule { // We will not find any dihedral angle from these bonds continue; }; - self.angles.insert(angle); + let _ = self.angles.insert(angle); // Find dihedral angles for bond3 in &self.bonds { @@ -137,7 +137,7 @@ impl Molecule { // improper dihedral. continue; }; - self.dihedrals.insert(dihedral); + let _ = self.dihedrals.insert(dihedral); } } } @@ -180,17 +180,17 @@ impl Molecule { assert_eq!(self.range.end, other.range.start); self.range.end = other.range.end; for bond in other.bonds() { - self.bonds.insert(*bond); + let _ = self.bonds.insert(*bond); } // Get angles and dihedrals from the other molecule, there is no need to // rebuild these. for angle in other.angles() { - self.angles.insert(*angle); + let _ = self.angles.insert(*angle); } for dihedral in other.dihedrals() { - self.dihedrals.insert(*dihedral); + let _ = self.dihedrals.insert(*dihedral); } self.rebuild_connections(); @@ -212,7 +212,7 @@ impl Molecule { let mut new_bonds = HashSet::new(); for bond in &self.bonds { - new_bonds.insert(Bond::new( + let _ = new_bonds.insert(Bond::new( bond.i().wrapping_add(delta), bond.j().wrapping_add(delta) )); @@ -221,7 +221,7 @@ impl Molecule { let mut new_angles = HashSet::new(); for angle in &self.angles { - new_angles.insert(Angle::new( + let _ = new_angles.insert(Angle::new( angle.i().wrapping_add(delta), angle.j().wrapping_add(delta), angle.k().wrapping_add(delta) @@ -231,7 +231,7 @@ impl Molecule { let mut new_dihedrals = HashSet::new(); for dihedral in &self.dihedrals { - new_dihedrals.insert(Dihedral::new( + let _ = new_dihedrals.insert(Dihedral::new( dihedral.i().wrapping_add(delta), dihedral.j().wrapping_add(delta), dihedral.k().wrapping_add(delta), @@ -247,7 +247,7 @@ impl Molecule { assert!(self.contains(i)); assert!(self.contains(j)); assert_ne!(i, j); - self.bonds.insert(Bond::new(i, j)); + let _ = self.bonds.insert(Bond::new(i, j)); self.rebuild(); } @@ -271,7 +271,7 @@ impl Molecule { bond_j -= 1; } - new_bonds.insert(Bond::new(bond_i, bond_j)); + let _ = new_bonds.insert(Bond::new(bond_i, bond_j)); } self.bonds = new_bonds; diff --git a/src/input/src/lib.rs b/src/input/src/lib.rs index e696b42fd..fd295750a 100644 --- a/src/input/src/lib.rs +++ b/src/input/src/lib.rs @@ -58,7 +58,7 @@ cast_possible_truncation, cast_precision_loss, cast_sign_loss, cast_possible_wrap, float_cmp, or_fun_call, string_add, non_ascii_literal, doc_markdown, missing_docs_in_private_items, module_inception, stutter, - unseparated_literal_suffix, new_without_default_derive + unseparated_literal_suffix, new_without_default_derive, use_self )] extern crate lumol; diff --git a/tests/mc-water.rs b/tests/mc-water.rs index 1456611ae..3b0786659 100644 --- a/tests/mc-water.rs +++ b/tests/mc-water.rs @@ -1,6 +1,5 @@ // Lumol, an extensible molecular simulation engine // Copyright (C) Lumol's contributors — BSD license -extern crate lumol; extern crate lumol_input as input; extern crate env_logger; diff --git a/tests/md-butane.rs b/tests/md-butane.rs index 0b22d4b15..d72622070 100644 --- a/tests/md-butane.rs +++ b/tests/md-butane.rs @@ -2,7 +2,6 @@ // Copyright (C) Lumol's contributors — BSD license //! Testing molecular dynamics of butane -extern crate lumol; extern crate lumol_input as input; extern crate env_logger; diff --git a/tests/md-methane.rs b/tests/md-methane.rs index 573f8a5e9..a68d64749 100644 --- a/tests/md-methane.rs +++ b/tests/md-methane.rs @@ -2,7 +2,6 @@ // Copyright (C) Lumol's contributors — BSD license //! Testing molecular dynamics of methane -extern crate lumol; extern crate lumol_input as input; extern crate env_logger; diff --git a/tests/md-water.rs b/tests/md-water.rs index f33619aef..eb48dd817 100644 --- a/tests/md-water.rs +++ b/tests/md-water.rs @@ -2,7 +2,6 @@ // Copyright (C) Lumol's contributors — BSD license //! Testing physical properties of f-SPC water -extern crate lumol; extern crate lumol_input as input; extern crate env_logger; diff --git a/tests/nist-spce.rs b/tests/nist-spce.rs index e57be52dc..9fbb083f0 100644 --- a/tests/nist-spce.rs +++ b/tests/nist-spce.rs @@ -4,9 +4,7 @@ //! Testing energy computation for SPC/E water using data from //! https://www.nist.gov/mml/csd/chemical-informatics-research-group/spce-water-reference-calculations-9%C3%A5-cutoff //! https://www.nist.gov/mml/csd/chemical-informatics-research-group/spce-water-reference-calculations-10å-cutoff - extern crate lumol; -extern crate lumol_input as input; use lumol::sys::{System, UnitCell}; use lumol::sys::TrajectoryBuilder;