Skip to content

Commit 3322ca4

Browse files
committed
hrp: small improvement in hrp parsing
1 parent e35cdda commit 3322ca4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/primitives/hrp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ impl Hrp {
7878
pub fn parse(hrp: &str) -> Result<Self, Error> {
7979
use Error::*;
8080

81-
let mut new = Hrp { buf: [0_u8; MAX_HRP_LEN], size: 0 };
82-
8381
if hrp.is_empty() {
8482
return Err(Empty);
8583
}
8684
if hrp.len() > MAX_HRP_LEN {
8785
return Err(TooLong(hrp.len()));
8886
}
8987

88+
let mut new = Hrp { buf: [0_u8; MAX_HRP_LEN], size: 0 };
89+
9090
let mut has_lower: bool = false;
9191
let mut has_upper: bool = false;
9292
for (i, c) in hrp.chars().enumerate() {

0 commit comments

Comments
 (0)