From 34a2c84a3c17a882ad019b4d554278e45650bd3a Mon Sep 17 00:00:00 2001 From: Yuval Shavit Date: Thu, 8 Aug 2024 21:02:07 -0400 Subject: [PATCH] TODOs -> references to #168 --- src/fmt_md.rs | 6 +++++- src/select/api.rs | 2 +- src/select/sel_table.rs | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/fmt_md.rs b/src/fmt_md.rs index 4272260..6731049 100644 --- a/src/fmt_md.rs +++ b/src/fmt_md.rs @@ -156,7 +156,11 @@ impl<'s, 'md> MdWriterState<'s, 'md> { MdElemRef::Paragraph(para) => self.write_paragraph(out, para), MdElemRef::BlockQuote(block) => self.write_block_quote(out, block), MdElemRef::List(list) => self.write_list(out, list), - MdElemRef::Table(table) => self.write_table(out, table.into()), // TODO maybe have a generic table trait, so I don't need to do the copying? + MdElemRef::Table(table) => { + // GH #168 maybe have a trait for tables, so we can parameterize write_table instead of calling into()? + // That would let us avoid copying various vecs. + self.write_table(out, table.into()) + } MdElemRef::TableSlice(table) => self.write_table(out, table), MdElemRef::Inline(inline) => { self.inlines_writer.write_inline_element(out, inline); diff --git a/src/select/api.rs b/src/select/api.rs index 204d690..34f1715 100644 --- a/src/select/api.rs +++ b/src/select/api.rs @@ -199,8 +199,8 @@ impl MdqRefSelector { fn build_output<'md>(&self, out: &mut Vec>, node: MdElemRef<'md>) { // try_select_node is defined in macro_helpers::selectors! + // GH #168 can we remove the clone()? Maybe by having try_select_node take a reference. match self.try_select_node(node.clone()) { - // TODO can we remove this? I don't think so, but let's follow up Some(found) => out.push(found), None => { for child in Self::find_children(node) { diff --git a/src/select/sel_table.rs b/src/select/sel_table.rs index 5c9b5b4..03bda55 100644 --- a/src/select/sel_table.rs +++ b/src/select/sel_table.rs @@ -35,7 +35,7 @@ impl TableSliceSelector { impl<'md> Selector<'md, TableSlice<'md>> for TableSliceSelector { fn try_select(&self, slice: TableSlice<'md>) -> Option> { - let mut slice = slice.clone(); // TODO is there any way to avoid this? There may not be. + let mut slice = slice.clone(); // GH #168 is there any way to avoid this? There may not be. slice.normalize(); slice.retain_columns_by_header(|line| self.headers_matcher.matches_inlines(line));