refactor(bip32): rename derivation path extend to join
What changed, and why it matters
This commit is a simple rename of a method from 'extend' to 'join' in a Rust Bitcoin library. It does not change what the code does, only its name. There is no security issue here.
No security action needed. Treat as a normal API naming refactor; downstream users will need to update call sites if they depend on the old method name.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit renames the public methods AbsoluteDerivationPath::extend and RelativeDerivationPath::extend to join, aligning with Rust’s path-like naming convention for non-mutating concatenation. The implementation, signatures, and behavior remain identical. Doc-test examples are updated to use the new name. This is a pure API refactor with no functional or security changes.
Changed components
key_expression/src/bip32.rsInspect captured patch +6 / −6
diff --git a/key_expression/src/bip32.rs b/key_expression/src/bip32.rs
index c99bef45..b655f6b5 100644
--- a/key_expression/src/bip32.rs
+++ b/key_expression/src/bip32.rs
@@ -511,9 +511,9 @@ impl AbsoluteDerivationPath {
/// Returns `true` if the relative path below the master key contains a hardened child number.
pub fn contains_hardened_child(&self) -> bool { self.0.contains_hardened_child() }
- /// Concatenate `self` with `path` and return the resulting new path.
+ /// Joins `self` with `path` and returns the resulting new path.
#[must_use]
- pub fn extend<T: AsRef<[ChildNumber]>>(&self, path: T) -> Self { Self(self.0.extend(path)) }
+ pub fn join<T: AsRef<[ChildNumber]>>(&self, path: T) -> Self { Self(self.0.join(path)) }
}
impl Default for AbsoluteDerivationPath {
@@ -628,15 +628,15 @@ impl RelativeDerivationPath {
RelativeDerivationPathIterator::start_from(self, ChildNumber::ZERO_HARDENED)
}
- /// Concatenate `self` with `path` and return the resulting new path.
+ /// Joins `self` with `path` and returns the resulting new path.
///
/// ```
/// use bitcoin_key_expression::bip32::{RelativeDerivationPath, ChildNumber};
///
/// let base = "42".parse::<RelativeDerivationPath>().unwrap();
///
- /// let deriv_1 = base.extend("0/1".parse::<RelativeDerivationPath>().unwrap());
- /// let deriv_2 = base.extend(&[
+ /// let deriv_1 = base.join("0/1".parse::<RelativeDerivationPath>().unwrap());
+ /// let deriv_2 = base.join(&[
/// ChildNumber::ZERO_NORMAL,
/// ChildNumber::ONE_NORMAL
/// ]);
@@ -644,7 +644,7 @@ impl RelativeDerivationPath {
/// assert_eq!(deriv_1, deriv_2);
/// ```
#[must_use]
- pub fn extend<T: AsRef<[ChildNumber]>>(&self, path: T) -> Self {
+ pub fn join<T: AsRef<[ChildNumber]>>(&self, path: T) -> Self {
let mut new_path = self.clone();
new_path.0.extend_from_slice(path.as_ref());
new_path
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.