chiark
/
gitweb
/
~ianmdlvl
/
otter.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0d35139
)
accounts: Break out pct closure
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 23 May 2021 23:28:20 +0000
(
00:28
+0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 30 May 2021 11:35:28 +0000
(12:35 +0100)
We're going to want to reuse it.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/accounts.rs
patch
|
blob
|
history
diff --git
a/src/accounts.rs
b/src/accounts.rs
index fb6f17e227acfade6224bfde59e86d4b41dd000d..9c12ca23e7ae99a1e75404c63d28d907a5efdbf1 100644
(file)
--- a/
src/accounts.rs
+++ b/
src/accounts.rs
@@
-122,6
+122,13
@@
impl AccountScope {
percent_encoding::NON_ALPHANUMERIC
.remove(b'-');
+ let pct = |n, f: &mut F| {
+ for frag in utf8_percent_encode(n, &ENCODE) {
+ f(frag)?;
+ }
+ Ok::<_,E>(())
+ };
+
match &self {
AS::Server => {
f("server")?;
@@
-134,9
+141,7
@@
impl AccountScope {
};
for n in ns {
f(":")?;
- for frag in utf8_percent_encode(n, &ENCODE) {
- f(frag)?;
- }
+ pct(n, &mut f)?;
}
}