Skip to content

Commit da80b14

Browse files
fix(block-editing): satisfy clippy -D warnings gate in nested-buffer code
Two lints the workspace clippy gate (added on main) denies: - regenerate_nested_buffers.rs: map_or(false, ..) -> is_some_and(..) - regenerate_nested_buffers_tests.rs: map(..).unwrap_or_else(panic) -> match
1 parent 235834a commit da80b14

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

crates/pampa/src/regenerate_nested_buffers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ fn maybe_emit(block: &Block, content: &str, out: &mut BTreeMap<String, String>)
173173
// final character. Every block offset range includes the block's trailing
174174
// newline, so `slice.contains('\n')` would match all single-line blocks.
175175
// We skip the last byte to detect only genuine continuation lines.
176-
let is_multiline = content.as_bytes().get(start..end).map_or(false, |b| {
176+
let is_multiline = content.as_bytes().get(start..end).is_some_and(|b| {
177177
let body = if b.last() == Some(&b'\n') {
178178
&b[..b.len() - 1]
179179
} else {

crates/pampa/tests/integration/regenerate_nested_buffers_tests.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ use quarto_source_map::SourceInfo;
1919
// =============================================================================
2020

2121
fn parse_qmd(content: &str) -> pampa::pandoc::Pandoc {
22-
qmd_to_pandoc(content.as_bytes())
23-
.map(|(pandoc, _ctx)| pandoc)
24-
.unwrap_or_else(|errs| panic!("Failed to parse QMD: {errs:?}"))
22+
match qmd_to_pandoc(content.as_bytes()) {
23+
Ok((pandoc, _ctx)) => pandoc,
24+
Err(errs) => panic!("Failed to parse QMD: {errs:?}"),
25+
}
2526
}
2627

2728
fn parse_qmd_with_context(content: &str) -> (pampa::pandoc::Pandoc, ASTContext) {

0 commit comments

Comments
 (0)