Don't use mutex

This commit is contained in:
Edward Shen 2021-02-26 18:54:35 -05:00
parent 531b28ed2b
commit 6b8386d449
Signed by: edward
GPG key ID: 19182661E818369F

View file

@ -634,8 +634,6 @@ fn section<'a, 'b>(
let (i, section_header) = section_header(i)?;
let mut newlines = 0;
// todo: unhack this (manually implement many0 and alt to avoid closure moves)
let node = std::sync::Mutex::new(node);
let (i, items) = many0(alt((
map(take_spaces, |space| {
vec![Event::Whitespace(Cow::Borrowed(space.into()))]
@ -645,7 +643,7 @@ fn section<'a, 'b>(
vec![Event::Newline(Cow::Borrowed(newline.into()))]
}),
map(
|i| section_body(i, *node.lock().unwrap()),
|i| section_body(i, node),
|(key, values)| {
let mut vec = vec![Event::Key(Cow::Borrowed(key.into()))];
vec.extend(values);