Skip to content

Commit

Permalink
refactor: make CI green
Browse files Browse the repository at this point in the history
  • Loading branch information
Eh2406 committed Oct 19, 2023
1 parent afe2d3c commit ba85ac4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/internal/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<T> Id<T> {
}
fn from(n: u32) -> Self {
Self {
raw: n as u32,
raw: n,
_ty: PhantomData,
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/internal/partial_solution.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MPL-2.0

//! A Memory acts like a structured partial solution
//! where terms are regrouped by package in a [Map](crate::type_aliases::Map).
//! where terms are regrouped by package in a [Map].

use std::fmt::Display;

Expand Down Expand Up @@ -147,7 +147,7 @@ impl<P: Package, VS: VersionSet> PartialSolution<P, VS> {
}
}
self.current_decision_level = self.current_decision_level.increment();
let mut pa = self
let pa = self
.package_assignments
.get_mut(&package)
.expect("Derivations must already exist");
Expand Down Expand Up @@ -177,7 +177,7 @@ impl<P: Package, VS: VersionSet> PartialSolution<P, VS> {
self.next_global_index += 1;
match self.package_assignments.entry(package) {
Entry::Occupied(mut occupied) => {
let mut pa = occupied.get_mut();
let pa = occupied.get_mut();
pa.highest_decision_level = self.current_decision_level;
match &mut pa.assignments_intersection {
// Check that add_derivation is never called in the wrong context.
Expand Down
6 changes: 3 additions & 3 deletions src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

//! Trait for identifying packages.
//! Automatically implemented for traits implementing
//! [Clone] + [Eq] + [Hash] + [Debug] + [Display](std::fmt::Display).
//! [Clone] + [Eq] + [Hash] + [Debug] + [Display].

use std::fmt::{Debug, Display};
use std::hash::Hash;

/// Trait for identifying packages.
/// Automatically implemented for types already implementing
/// [Clone] + [Eq] + [Hash] + [Debug] + [Display](std::fmt::Display).
/// [Clone] + [Eq] + [Hash] + [Debug] + [Display].
pub trait Package: Clone + Eq + Hash + Debug + Display {}

/// Automatically implement the Package trait for any type
/// that already implement [Clone] + [Eq] + [Hash] + [Debug] + [Display](std::fmt::Display).
/// that already implement [Clone] + [Eq] + [Hash] + [Debug] + [Display].
impl<T: Clone + Eq + Hash + Debug + Display> Package for T {}
4 changes: 2 additions & 2 deletions src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl DefaultStringReporter {
fn build_recursive<P: Package, VS: VersionSet>(&mut self, derived: &Derived<P, VS>) {
self.build_recursive_helper(derived);
if let Some(id) = derived.shared_id {
if self.shared_with_ref.get(&id) == None {
if self.shared_with_ref.get(&id).is_none() {
self.add_line_ref();
self.shared_with_ref.insert(id, self.ref_count);
}
Expand Down Expand Up @@ -260,7 +260,7 @@ impl DefaultStringReporter {
// and finally conclude.
(None, None) => {
self.build_recursive(derived1);
if derived1.shared_id != None {
if derived1.shared_id.is_some() {
self.lines.push("".into());
self.build_recursive(current);
} else {
Expand Down
8 changes: 4 additions & 4 deletions src/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
//!
//! The algorithm is generic and works for any type of dependency system
//! as long as packages (P) and versions (V) implement
//! the [Package](crate::package::Package) and [Version](crate::version::Version) traits.
//! [Package](crate::package::Package) is strictly equivalent and automatically generated
//! the [Package] and [Version](crate::version::Version) traits.
//! [Package] is strictly equivalent and automatically generated
//! for any type that implement [Clone] + [Eq] + [Hash] + [Debug] + [Display](std::fmt::Display).
//! [Version](crate::version::Version) simply states that versions are ordered,
//! that there should be
Expand Down Expand Up @@ -298,13 +298,13 @@ where
{
let count_valid = |(p, set): &(T, U)| {
list_available_versions(p.borrow())
.filter(|v| set.borrow().contains(v.borrow()))
.filter(|v| set.borrow().contains(v))
.count()
};
let (pkg, set) = potential_packages
.min_by_key(count_valid)
.expect("potential_packages gave us an empty iterator");
let version = list_available_versions(pkg.borrow()).find(|v| set.borrow().contains(v.borrow()));
let version = list_available_versions(pkg.borrow()).find(|v| set.borrow().contains(v));
(pkg, version)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/proptest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ fn large_case() {
let mut sat = SatResolve::new(&dependency_provider);
for p in dependency_provider.packages() {
for n in dependency_provider.versions(p).unwrap() {
if let Ok(s) = resolve(&dependency_provider, p.clone(), n.clone()) {
if let Ok(s) = resolve(&dependency_provider, p, n.clone()) {
assert!(sat.sat_is_valid_solution(&s));
} else {
assert!(!sat.sat_resolve(p, &n));
Expand Down

0 comments on commit ba85ac4

Please sign in to comment.