Skip to content

Commit 7063e4a

Browse files
committed
Enable use_self lint
Tighten up the linting by using `use_self` and fix all warnings. I got claude to do the fixes. It eventually found its way to using cargo clippy --fix --allow-dirty --allow-staged --workspace \ --all-targets --all-features -- -D clippy::use-self FTR this does not enable the lint because for some reason adding this to the manifest doesn't work. ```rust [workspace.lints.clippy] use_self = "warn" ``` I tested this patch using `cargo +$(cat ./nightly-version ) clippy -- -D clippy::use-self`
1 parent 32554e0 commit 7063e4a

43 files changed

Lines changed: 1088 additions & 1088 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/descriptor/bare.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<Pk: FromStrKey> FromTree for Bare<Pk> {
166166
fn from_tree(root: expression::TreeIterItem) -> Result<Self, Error> {
167167
let sub = Miniscript::<Pk, BareCtx>::from_tree(root)?;
168168
BareCtx::top_level_checks(&sub)?;
169-
Bare::new(sub)
169+
Self::new(sub)
170170
}
171171
}
172172

@@ -196,7 +196,7 @@ impl<Pk: MiniscriptKey> Pkh<Pk> {
196196
pub fn new(pk: Pk) -> Result<Self, ScriptContextError> {
197197
// do the top-level checks
198198
match BareCtx::check_pk(&pk) {
199-
Ok(()) => Ok(Pkh { pk }),
199+
Ok(()) => Ok(Self { pk }),
200200
Err(e) => Err(e),
201201
}
202202
}
@@ -353,7 +353,7 @@ impl<Pk: FromStrKey> FromTree for Pkh<Pk> {
353353
let pk = root
354354
.verify_terminal_parent("pkh", "public key")
355355
.map_err(Error::Parse)?;
356-
Pkh::new(pk).map_err(Error::ContextError)
356+
Self::new(pk).map_err(Error::ContextError)
357357
}
358358
}
359359

src/descriptor/checksum.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ pub enum Error {
6161
impl fmt::Display for Error {
6262
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
6363
match *self {
64-
Error::InvalidCharacter { ch, pos } => {
64+
Self::InvalidCharacter { ch, pos } => {
6565
write!(f, "invalid character '{}' (position {})", ch, pos)
6666
}
67-
Error::InvalidChecksumLength { actual, expected } => {
67+
Self::InvalidChecksumLength { actual, expected } => {
6868
write!(f, "invalid checksum (length {}, expected {})", actual, expected)
6969
}
70-
Error::InvalidChecksum { actual, expected } => {
70+
Self::InvalidChecksum { actual, expected } => {
7171
f.write_str("invalid checksum ")?;
7272
for ch in actual {
7373
ch.fmt(f)?;
@@ -135,13 +135,13 @@ pub struct Engine {
135135
}
136136

137137
impl Default for Engine {
138-
fn default() -> Engine { Engine::new() }
138+
fn default() -> Self { Self::new() }
139139
}
140140

141141
impl Engine {
142142
/// Constructs an engine with no input.
143143
pub fn new() -> Self {
144-
Engine { inner: bech32::primitives::checksum::Engine::new(), cls: 0, clscount: 0 }
144+
Self { inner: bech32::primitives::checksum::Engine::new(), cls: 0, clscount: 0 }
145145
}
146146

147147
/// Inputs some data into the checksum engine.

0 commit comments

Comments
 (0)