Skip to content

Commit

Permalink
style: Make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Nov 5, 2022
1 parent c855372 commit 52e12ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
21 changes: 7 additions & 14 deletions crates/core/src/reflection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct Parameter<'a>(&'a str, &'a dyn fmt::Display);
impl<'a> Parameter<'a> {
/// Create a new `Parameter`.
pub fn new(key: &'a str, value: &'a dyn fmt::Display) -> Self {
Self { 0: key, 1: value }
Self(key, value)
}

/// Access the `Parameter` name.
Expand Down Expand Up @@ -72,7 +72,7 @@ pub struct Child<'a>(&'a str, &'a dyn PredicateReflection);
impl<'a> Child<'a> {
/// Create a new `Predicate` child.
pub fn new(key: &'a str, value: &'a dyn PredicateReflection) -> Self {
Self { 0: key, 1: value }
Self(key, value)
}

/// Access the `Child`'s name.
Expand Down Expand Up @@ -141,16 +141,12 @@ impl<'a> Case<'a> {

/// Access the by-products from determining this case.
pub fn products(&self) -> CaseProducts<'_> {
CaseProducts {
0: self.products.iter(),
}
CaseProducts(self.products.iter())
}

/// Access the sub-cases.
pub fn children(&self) -> CaseChildren<'_> {
CaseChildren {
0: self.children.iter(),
}
CaseChildren(self.children.iter())
}
}

Expand Down Expand Up @@ -229,10 +225,7 @@ impl Product {
S: Into<borrow::Cow<'static, str>>,
D: fmt::Display + 'static,
{
Self {
0: key.into(),
1: Box::new(value),
}
Self(key.into(), Box::new(value))
}

/// Access the `Product` name.
Expand All @@ -246,13 +239,13 @@ impl Product {
}
}

impl<'a> fmt::Display for Product {
impl fmt::Display for Product {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}: {}", self.0, self.1)
}
}

impl<'a> fmt::Debug for Product {
impl fmt::Debug for Product {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "({:?}, {})", self.0, self.1)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/tree/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fn convert(case: &reflection::Case<'_>) -> CaseTreeInner {
termtree::Tree::new(root).with_multiline(true)
}));

leaves.extend(case.children().map(|item| convert(item)));
leaves.extend(case.children().map(convert));

let root = Box::new(case.predicate().map(|p| p.to_string()).unwrap_or_default());
CaseTreeInner::new(root).with_leaves(leaves)
Expand Down

0 comments on commit 52e12ce

Please sign in to comment.