diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-10-05 13:35:44 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-10-12 20:22:20 +0300 |
commit | c1b0e3fe880bbf39cc39074d67a697f7b7e9ba22 (patch) | |
tree | 627e538569c7e9db503ab104ad524174260fa242 /src | |
parent | 2550484458f46c8811d6290f3c402a97cc6e907f (diff) | |
download | subplot-c1b0e3fe880bbf39cc39074d67a697f7b7e9ba22.tar.gz |
fix(portability): avoid using str::split_once
Sequoia wants Rust 1.48.0 and split_once is not in that version. We
can easily accommodate Sequoia's needs here with a simple change.
Sponsored-by: author
Diffstat (limited to 'src')
-rw-r--r-- | src/ast.rs | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -224,7 +224,9 @@ fn parse_code_block_attrs(attrs: &str) -> Attr { id = x.to_string(); } else if let Some(x) = word.strip_prefix('.') { classes.push(x.to_string()); - } else if let Some((k, v)) = word.split_once('=') { + } else if let Some(i) = word.find('=') { + let k = &word[..i]; + let v = &word[i + 1..]; keyvalues.push((k.to_string(), v.to_string())); } } |