Skip to content

Commit cd02f23

Browse files
committed
Remove Eq bound for M
1 parent 4099a2e commit cd02f23

File tree

6 files changed

+28
-32
lines changed

6 files changed

+28
-32
lines changed

src/internal/incompatibility.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use crate::{
2828
/// during conflict resolution. More about all this in
2929
/// [PubGrub documentation](https://github.com/dart-lang/pub/blob/master/doc/solver.md#incompatibility).
3030
#[derive(Debug, Clone)]
31-
pub(crate) struct Incompatibility<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> {
31+
pub(crate) struct Incompatibility<P: Package, VS: VersionSet, M: Clone + Debug + Display> {
3232
package_terms: SmallMap<P, Term<VS>>,
3333
kind: Kind<P, VS, M>,
3434
}
@@ -43,7 +43,7 @@ pub(crate) type IncompDpId<DP> = IncompId<
4343
>;
4444

4545
#[derive(Debug, Clone)]
46-
enum Kind<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> {
46+
enum Kind<P: Package, VS: VersionSet, M: Clone + Debug + Display> {
4747
/// Initial incompatibility aiming at picking the root package for the first decision.
4848
///
4949
/// This incompatibility drives the resolution, it requires that we pick the (virtual) root
@@ -91,7 +91,7 @@ pub(crate) enum Relation<P: Package> {
9191
Inconclusive,
9292
}
9393

94-
impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> Incompatibility<P, VS, M> {
94+
impl<P: Package, VS: VersionSet, M: Clone + Debug + Display> Incompatibility<P, VS, M> {
9595
/// Create the initial "not Root" incompatibility.
9696
pub(crate) fn not_root(package: P, version: VS::V) -> Self {
9797
Self {
@@ -306,7 +306,7 @@ impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> Incompatibilit
306306
}
307307
}
308308

309-
impl<'a, P: Package, VS: VersionSet + 'a, M: Eq + Clone + Debug + Display + 'a>
309+
impl<'a, P: Package, VS: VersionSet + 'a, M: Clone + Debug + Display + 'a>
310310
Incompatibility<P, VS, M>
311311
{
312312
/// CF definition of Relation enum.
@@ -336,9 +336,7 @@ impl<'a, P: Package, VS: VersionSet + 'a, M: Eq + Clone + Debug + Display + 'a>
336336
}
337337
}
338338

339-
impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> Display
340-
for Incompatibility<P, VS, M>
341-
{
339+
impl<P: Package, VS: VersionSet, M: Clone + Debug + Display> Display for Incompatibility<P, VS, M> {
342340
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
343341
write!(
344342
f,

src/internal/partial_solution.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ impl<DP: DependencyProvider> Display for PartialSolution<DP> {
7272
/// that have already been made for a given package,
7373
/// as well as the intersection of terms by all of these.
7474
#[derive(Clone, Debug)]
75-
struct PackageAssignments<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> {
75+
struct PackageAssignments<P: Package, VS: VersionSet, M: Clone + Debug + Display> {
7676
smallest_decision_level: DecisionLevel,
7777
highest_decision_level: DecisionLevel,
7878
dated_derivations: SmallVec<DatedDerivation<P, VS, M>>,
7979
assignments_intersection: AssignmentsIntersection<VS>,
8080
}
8181

82-
impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> Display
82+
impl<P: Package, VS: VersionSet, M: Clone + Debug + Display> Display
8383
for PackageAssignments<P, VS, M>
8484
{
8585
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
@@ -100,16 +100,14 @@ impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> Display
100100
}
101101

102102
#[derive(Clone, Debug)]
103-
struct DatedDerivation<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> {
103+
struct DatedDerivation<P: Package, VS: VersionSet, M: Clone + Debug + Display> {
104104
global_index: u32,
105105
decision_level: DecisionLevel,
106106
cause: IncompId<P, VS, M>,
107107
accumulated_intersection: Term<VS>,
108108
}
109109

110-
impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> Display
111-
for DatedDerivation<P, VS, M>
112-
{
110+
impl<P: Package, VS: VersionSet, M: Clone + Debug + Display> Display for DatedDerivation<P, VS, M> {
113111
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
114112
write!(f, "{:?}, cause: {:?}", self.decision_level, self.cause)
115113
}
@@ -133,7 +131,7 @@ impl<VS: VersionSet> Display for AssignmentsIntersection<VS> {
133131
}
134132

135133
#[derive(Clone, Debug)]
136-
pub(crate) enum SatisfierSearch<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> {
134+
pub(crate) enum SatisfierSearch<P: Package, VS: VersionSet, M: Clone + Debug + Display> {
137135
DifferentDecisionLevels {
138136
previous_satisfier_level: DecisionLevel,
139137
},
@@ -506,7 +504,7 @@ impl<DP: DependencyProvider> PartialSolution<DP> {
506504
}
507505
}
508506

509-
impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> PackageAssignments<P, VS, M> {
507+
impl<P: Package, VS: VersionSet, M: Clone + Debug + Display> PackageAssignments<P, VS, M> {
510508
fn satisfier(
511509
&self,
512510
package: &P,

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
//! # use pubgrub::{Package, VersionSet, DerivationTree};
161161
//! # use std::fmt::{Debug, Display};
162162
//! #
163-
//! pub trait Reporter<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> {
163+
//! pub trait Reporter<P: Package, VS: VersionSet, M: Clone + Debug + Display> {
164164
//! type Output;
165165
//!
166166
//! fn report(derivation_tree: &DerivationTree<P, VS, M>) -> Self::Output;

src/report.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::sync::Arc;
1010
use crate::{Map, Package, Set, Term, VersionSet};
1111

1212
/// Reporter trait.
13-
pub trait Reporter<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> {
13+
pub trait Reporter<P: Package, VS: VersionSet, M: Clone + Debug + Display> {
1414
/// Output type of the report.
1515
type Output;
1616

@@ -29,7 +29,7 @@ pub trait Reporter<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display>
2929
/// Derivation tree resulting in the impossibility
3030
/// to solve the dependencies of our root package.
3131
#[derive(Debug, Clone)]
32-
pub enum DerivationTree<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> {
32+
pub enum DerivationTree<P: Package, VS: VersionSet, M: Clone + Debug + Display> {
3333
/// External incompatibility.
3434
External(External<P, VS, M>),
3535
/// Incompatibility derived from two others.
@@ -39,7 +39,7 @@ pub enum DerivationTree<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Disp
3939
/// Incompatibilities that are not derived from others,
4040
/// they have their own reason.
4141
#[derive(Debug, Clone)]
42-
pub enum External<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> {
42+
pub enum External<P: Package, VS: VersionSet, M: Clone + Debug + Display> {
4343
/// Initial incompatibility aiming at picking the root package for the first decision.
4444
NotRoot(P, VS::V),
4545
/// There are no versions in the given set for this package.
@@ -52,7 +52,7 @@ pub enum External<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> {
5252

5353
/// Incompatibility derived from two others.
5454
#[derive(Debug, Clone)]
55-
pub struct Derived<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> {
55+
pub struct Derived<P: Package, VS: VersionSet, M: Clone + Debug + Display> {
5656
/// Terms of the incompatibility.
5757
pub terms: Map<P, Term<VS>>,
5858
/// Indicate if that incompatibility is present multiple times
@@ -67,7 +67,7 @@ pub struct Derived<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display>
6767
pub cause2: Arc<DerivationTree<P, VS, M>>,
6868
}
6969

70-
impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> DerivationTree<P, VS, M> {
70+
impl<P: Package, VS: VersionSet, M: Clone + Debug + Display> DerivationTree<P, VS, M> {
7171
/// Get all packages referred to in the derivation tree.
7272
pub fn packages(&self) -> Set<&P> {
7373
let mut packages = Set::default();
@@ -167,7 +167,7 @@ impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> DerivationTree
167167
}
168168
}
169169

170-
impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> Display for External<P, VS, M> {
170+
impl<P: Package, VS: VersionSet, M: Clone + Debug + Display> Display for External<P, VS, M> {
171171
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
172172
match self {
173173
Self::NotRoot(package, version) => {
@@ -211,7 +211,7 @@ impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> Display for Ex
211211
}
212212

213213
/// Trait for formatting outputs in the reporter.
214-
pub trait ReportFormatter<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> {
214+
pub trait ReportFormatter<P: Package, VS: VersionSet, M: Clone + Debug + Display> {
215215
/// Output type of the report.
216216
type Output;
217217

@@ -278,7 +278,7 @@ pub trait ReportFormatter<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Di
278278
#[derive(Default, Debug)]
279279
pub struct DefaultStringReportFormatter;
280280

281-
impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> ReportFormatter<P, VS, M>
281+
impl<P: Package, VS: VersionSet, M: Clone + Debug + Display> ReportFormatter<P, VS, M>
282282
for DefaultStringReportFormatter
283283
{
284284
type Output = String;
@@ -431,7 +431,7 @@ impl DefaultStringReporter {
431431
fn build_recursive<
432432
P: Package,
433433
VS: VersionSet,
434-
M: Eq + Clone + Debug + Display,
434+
M: Clone + Debug + Display,
435435
F: ReportFormatter<P, VS, M, Output = String>,
436436
>(
437437
&mut self,
@@ -451,7 +451,7 @@ impl DefaultStringReporter {
451451
fn build_recursive_helper<
452452
P: Package,
453453
VS: VersionSet,
454-
M: Eq + Clone + Debug + Display,
454+
M: Clone + Debug + Display,
455455
F: ReportFormatter<P, VS, M, Output = String>,
456456
>(
457457
&mut self,
@@ -540,7 +540,7 @@ impl DefaultStringReporter {
540540
fn report_one_each<
541541
P: Package,
542542
VS: VersionSet,
543-
M: Eq + Clone + Debug + Display,
543+
M: Clone + Debug + Display,
544544
F: ReportFormatter<P, VS, M, Output = String>,
545545
>(
546546
&mut self,
@@ -564,7 +564,7 @@ impl DefaultStringReporter {
564564
fn report_recurse_one_each<
565565
P: Package,
566566
VS: VersionSet,
567-
M: Eq + Clone + Debug + Display,
567+
M: Clone + Debug + Display,
568568
F: ReportFormatter<P, VS, M, Output = String>,
569569
>(
570570
&mut self,
@@ -617,7 +617,7 @@ impl DefaultStringReporter {
617617
}
618618
}
619619

620-
impl<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> Reporter<P, VS, M>
620+
impl<P: Package, VS: VersionSet, M: Clone + Debug + Display> Reporter<P, VS, M>
621621
for DefaultStringReporter
622622
{
623623
type Output = String;

src/solver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub fn resolve<DP: DependencyProvider>(
178178
/// An enum used by [DependencyProvider] that holds information about package dependencies.
179179
/// For each [Package] there is a set of versions allowed as a dependency.
180180
#[derive(Clone)]
181-
pub enum Dependencies<P: Package, VS: VersionSet, M: Eq + Clone + Debug + Display> {
181+
pub enum Dependencies<P: Package, VS: VersionSet, M: Clone + Debug + Display> {
182182
/// Package dependencies are unavailable with the reason why they are missing.
183183
Unavailable(M),
184184
/// Container for all available package versions.
@@ -212,7 +212,7 @@ pub trait DependencyProvider {
212212
///
213213
/// The intended use is to track them in an enum and assign them to this type. You can also
214214
/// assign [`String`] as placeholder.
215-
type M: Eq + Clone + Debug + Display;
215+
type M: Clone + Debug + Display;
216216

217217
/// [Decision making](https://github.com/dart-lang/pub/blob/master/doc/solver.md#decision-making)
218218
/// is the process of choosing the next package

tests/proptest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ fn errors_the_same_with_only_report_dependencies<N: Package + Ord>(
370370
return;
371371
};
372372

373-
fn recursive<N: Package + Ord, VS: VersionSet, M: Eq + Clone + Debug + Display>(
373+
fn recursive<N: Package + Ord, VS: VersionSet, M: Clone + Debug + Display>(
374374
to_retain: &mut Vec<(N, VS, N)>,
375375
tree: &DerivationTree<N, VS, M>,
376376
) {

0 commit comments

Comments
 (0)