Skip to content

Commit 7c8d78e

Browse files
authored
chain-ethereum: trash dead code in capabilities.rs (#4423)
1 parent 54d4974 commit 7c8d78e

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

chain/ethereum/src/capabilities.rs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
use anyhow::Error;
21
use graph::impl_slog_value;
32
use std::cmp::Ordering;
4-
use std::collections::BTreeSet;
53
use std::fmt;
6-
use std::str::FromStr;
74

85
use crate::DataSource;
96

@@ -17,7 +14,7 @@ pub struct NodeCapabilities {
1714
/// other. No [`Ord`] (i.e. total order) implementation is applicable.
1815
impl PartialOrd for NodeCapabilities {
1916
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
20-
product_order([
17+
product_order(&[
2118
self.archive.cmp(&other.archive),
2219
self.traces.cmp(&other.traces),
2320
])
@@ -26,7 +23,7 @@ impl PartialOrd for NodeCapabilities {
2623

2724
/// Defines a [product order](https://en.wikipedia.org/wiki/Product_order) over
2825
/// an array of [`Ordering`].
29-
fn product_order<const N: usize>(cmps: [Ordering; N]) -> Option<Ordering> {
26+
fn product_order(cmps: &[Ordering]) -> Option<Ordering> {
3027
if cmps.iter().all(|c| c.is_eq()) {
3128
Some(Ordering::Equal)
3229
} else if cmps.iter().all(|c| c.is_le()) {
@@ -38,18 +35,6 @@ fn product_order<const N: usize>(cmps: [Ordering; N]) -> Option<Ordering> {
3835
}
3936
}
4037

41-
impl FromStr for NodeCapabilities {
42-
type Err = Error;
43-
44-
fn from_str(s: &str) -> Result<Self, Self::Err> {
45-
let capabilities: BTreeSet<&str> = s.split(',').collect();
46-
Ok(NodeCapabilities {
47-
archive: capabilities.contains("archive"),
48-
traces: capabilities.contains("traces"),
49-
})
50-
}
51-
}
52-
5338
impl fmt::Display for NodeCapabilities {
5439
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
5540
let NodeCapabilities { archive, traces } = self;

0 commit comments

Comments
 (0)