summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-10-05 13:35:44 +0300
committerLars Wirzenius <liw@liw.fi>2021-10-12 20:22:20 +0300
commitc1b0e3fe880bbf39cc39074d67a697f7b7e9ba22 (patch)
tree627e538569c7e9db503ab104ad524174260fa242
parent2550484458f46c8811d6290f3c402a97cc6e907f (diff)
downloadsubplot-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
-rw-r--r--src/ast.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ast.rs b/src/ast.rs
index 6255fb5..7135f36 100644
--- a/src/ast.rs
+++ b/src/ast.rs
@@ -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()));
}
}