Skip to content

Commit

Permalink
Remove special case for decoding a single byte
Browse files Browse the repository at this point in the history
  • Loading branch information
alajpie committed Jun 17, 2020
1 parent 57b3683 commit d29fe48
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "urbit-q"
version = "0.3.0"
version = "0.3.1"
authors = ["k2l8m11n2"]
edition = "2018"
description = "Encode and decode data in Urbit's @q format"
Expand Down
5 changes: 0 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,6 @@ pub fn encode(input: &[u8]) -> String {
pub fn decode(input: &str) -> Option<Vec<u8>> {
let mut bytes = Vec::from(input);
bytes.retain(|x| *x != ('-' as u8) && *x != ('~' as u8) && *x != (' ' as u8));
if bytes.len() == 3 {
bytes[0] = *consts::SUFFIXES_MAP.get(&bytes[..])?;
bytes.truncate(1);
return Some(bytes);
}
match bytes.len() % 6 {
0 => {
for i in (0..bytes.len()).step_by(6) {
Expand Down

0 comments on commit d29fe48

Please sign in to comment.