Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sanket1729 committed Dec 24, 2024
1 parent f2ccc62 commit ab42d67
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 25 deletions.
8 changes: 4 additions & 4 deletions src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ impl<'a, A> BTreeSlice<'a, A> {
}
}

impl<'a, A: Clone> BTreeSlice<'a, A> {
impl<A: Clone> BTreeSlice<'_, A> {
/// Fold the tree in post order, using the binary function `f`.
///
/// Returns `None` if the tree is empty.
Expand Down Expand Up @@ -57,7 +57,7 @@ impl<'a, A: Clone> BTreeSlice<'a, A> {
}
}

impl<'a, A: Clone> TreeLike for BTreeSlice<'a, A> {
impl<A: Clone> TreeLike for BTreeSlice<'_, A> {
fn as_node(&self) -> Tree<Self> {
match self.0.len() {
0 | 1 => Tree::Nullary,
Expand Down Expand Up @@ -169,7 +169,7 @@ impl<'a, A> Partition<'a, A> {
}
}

impl<'a, A: Clone> Partition<'a, A> {
impl<A: Clone> Partition<'_, A> {
/// Check if the partition is complete.
///
/// A complete partition contains no empty blocks.
Expand Down Expand Up @@ -213,7 +213,7 @@ impl<'a, A: Clone> Partition<'a, A> {
}

#[rustfmt::skip]
impl<'a, A: Clone> TreeLike for Partition<'a, A> {
impl<A: Clone> TreeLike for Partition<'_, A> {
fn as_node(&self) -> Tree<Self> {
match self {
Self::Leaf {..} => Tree::Nullary,
Expand Down
2 changes: 1 addition & 1 deletion src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ pub enum ExprTree<'a> {
Match(&'a Match),
}

impl<'a> TreeLike for ExprTree<'a> {
impl TreeLike for ExprTree<'_> {
fn as_node(&self) -> Tree<Self> {
use SingleExpressionInner as S;

Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl<'a> From<&'a pest::iterators::Pair<'_, Rule>> for Span {
}
}

impl<'a> From<&'a str> for Span {
impl From<&str> for Span {
fn from(s: &str) -> Self {
let start = Position::new(1, 1);
let end_line = std::cmp::max(1, s.lines().count());
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// Library for parsing and compiling simfony
//! Library for parsing and compiling simfony
pub type ProgNode = Arc<named::ConstructNode>;

Expand Down Expand Up @@ -247,6 +247,7 @@ pub trait ArbitraryOfType: Sized {
mod tests {
use base64::display::Base64Display;
use base64::engine::general_purpose::STANDARD;
#[cfg(feature = "serde")]
use elements::LockTime;
use simplicity::BitMachine;
use std::borrow::Cow;
Expand Down
8 changes: 4 additions & 4 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ pub enum ExprTree<'a> {
Match(&'a Match),
}

impl<'a> TreeLike for ExprTree<'a> {
impl TreeLike for ExprTree<'_> {
fn as_node(&self) -> Tree<Self> {
use SingleExpressionInner as S;

Expand Down Expand Up @@ -596,7 +596,7 @@ impl<'a> TreeLike for ExprTree<'a> {
}
}

impl<'a> fmt::Display for ExprTree<'a> {
impl fmt::Display for ExprTree<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use SingleExpressionInner as S;

Expand Down Expand Up @@ -1512,7 +1512,7 @@ impl PestParse for ModuleAssignment {
#[derive(Clone, Debug)]
struct PatternPair<'a>(pest::iterators::Pair<'a, Rule>);

impl<'a> TreeLike for PatternPair<'a> {
impl TreeLike for PatternPair<'_> {
fn as_node(&self) -> Tree<Self> {
let mut it = self.0.clone().into_inner();
match self.0.as_rule() {
Expand All @@ -1534,7 +1534,7 @@ impl<'a> TreeLike for PatternPair<'a> {
#[derive(Clone, Debug)]
struct TyPair<'a>(pest::iterators::Pair<'a, Rule>);

impl<'a> TreeLike for TyPair<'a> {
impl TreeLike for TyPair<'_> {
fn as_node(&self) -> Tree<Self> {
let mut it = self.0.clone().into_inner();
match self.0.as_rule() {
Expand Down
4 changes: 2 additions & 2 deletions src/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl Pattern {
}
}

impl<'a> TreeLike for &'a Pattern {
impl TreeLike for &Pattern {
fn as_node(&self) -> Tree<Self> {
match self {
Pattern::Identifier(_) | Pattern::Ignore => Tree::Nullary,
Expand Down Expand Up @@ -170,7 +170,7 @@ pub enum BasePattern {
Product(Arc<Self>, Arc<Self>),
}

impl<'a> TreeLike for &'a BasePattern {
impl TreeLike for &BasePattern {
fn as_node(&self) -> Tree<Self> {
match self {
BasePattern::Ignore | BasePattern::Identifier(_) => Tree::Nullary,
Expand Down
10 changes: 5 additions & 5 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl fmt::Display for UIntType {
}
}

impl<'a> TryFrom<&'a StructuralType> for UIntType {
impl TryFrom<&StructuralType> for UIntType {
type Error = ();

fn try_from(value: &StructuralType) -> Result<Self, Self::Error> {
Expand All @@ -215,7 +215,7 @@ impl<'a> TryFrom<&'a StructuralType> for UIntType {
}
}

impl<'a> TryFrom<&'a ResolvedType> for UIntType {
impl TryFrom<&ResolvedType> for UIntType {
type Error = ();

fn try_from(value: &ResolvedType) -> Result<Self, Self::Error> {
Expand Down Expand Up @@ -402,7 +402,7 @@ impl TypeDeconstructible for ResolvedType {
}
}

impl<'a> TreeLike for &'a ResolvedType {
impl TreeLike for &ResolvedType {
fn as_node(&self) -> Tree<Self> {
match &self.0 {
TypeInner::Boolean | TypeInner::UInt(..) => Tree::Nullary,
Expand Down Expand Up @@ -698,7 +698,7 @@ impl TypeDeconstructible for AliasedType {
}
}

impl<'a> TreeLike for &'a AliasedType {
impl TreeLike for &AliasedType {
fn as_node(&self) -> Tree<Self> {
match &self.0 {
AliasedInner::Alias(_) | AliasedInner::Builtin(_) => Tree::Nullary,
Expand Down Expand Up @@ -974,7 +974,7 @@ impl From<UIntType> for StructuralType {
}
}

impl<'a> From<&'a ResolvedType> for StructuralType {
impl From<&ResolvedType> for StructuralType {
fn from(value: &ResolvedType) -> Self {
let mut output = vec![];
for data in value.post_order_iter() {
Expand Down
15 changes: 8 additions & 7 deletions src/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ pub struct Value {
ty: ResolvedType,
}

impl<'a> TreeLike for &'a Value {
impl TreeLike for &Value {
fn as_node(&self) -> Tree<Self> {
match &self.inner {
ValueInner::Option(None) | ValueInner::Boolean(_) | ValueInner::UInt(_) => {
Expand Down Expand Up @@ -443,10 +443,11 @@ impl fmt::Display for Value {
}
},
ValueInner::Boolean(bit) => write!(f, "{bit}")?,
ValueInner::UInt(integer) => match print_hex_byte_array {
false => write!(f, "{integer}")?,
true => {} // bytes have already been printed
},
ValueInner::UInt(integer) => {
if !print_hex_byte_array {
write!(f, "{integer}")?
}
}
ValueInner::Tuple(tuple) => {
if data.n_children_yielded == 0 {
write!(f, "(")?;
Expand Down Expand Up @@ -998,7 +999,7 @@ impl From<UIntValue> for StructuralValue {
}
}

impl<'a> From<&'a Value> for StructuralValue {
impl From<&Value> for StructuralValue {
fn from(value: &Value) -> Self {
let mut output = vec![];
for data in value.post_order_iter() {
Expand Down Expand Up @@ -1110,7 +1111,7 @@ impl<'a> Destructor<'a> {
}
}

impl<'a> TreeLike for Destructor<'a> {
impl TreeLike for Destructor<'_> {
fn as_node(&self) -> Tree<Self> {
let (value, ty) = match self {
Self::Ok { value, ty } => (value, ty),
Expand Down

0 comments on commit ab42d67

Please sign in to comment.