Skip to content

Commit

Permalink
fix: bad debug line, fold char conversion into loop
Browse files Browse the repository at this point in the history
Co-authored-by: ljedrz <3750347+ljedrz@users.noreply.github.com>
  • Loading branch information
AgentElement and ljedrz authored Jul 22, 2024
1 parent fcd6ff9 commit f4278f1
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,18 +504,17 @@ impl fmt::Display for Term {
}

fn base26_encode(mut n: u32) -> String {
let mut buf = Vec::<u32>::new();
let mut buf = Vec::<u8>::new();
n += 1;
while n > 0 {
let m = n % 26;
buf.push(if m == 0 { 26 } else { m });
let m = (n % 26) as u8;
let m = if m == 0 { 26 } else { m };
let c = m + 'a' as u8 - 1;
buf.push(c);
n = (n - 1) / 26
}
println!("{:?}", buf);
buf.iter()
.map(|u| char::from_u32(u + 'a' as u32 - 1).expect("error while printing term"))
.rev()
.collect::<String>()
buf.reverse();
String::from_utf8(buf).expect("error while printing term")
}

fn show_precedence_cla(
Expand Down

0 comments on commit f4278f1

Please sign in to comment.