MCPcopy Create free account
hub / github.com/Canop/codesort / recognize

Method recognize

src/spacing.rs:16–29  ·  view source on GitHub ↗
(blocks: &[LocList])

Source from the content-addressed store, hash-verified

14
15impl Spacing {
16 pub fn recognize(blocks: &[LocList]) -> Spacing {
17 let mut blocks = blocks.iter();
18 let Some(first) = blocks.next() else {
19 return Self::Other;
20 };
21 if first.count_blank_lines_at_start() > 0 {
22 return Self::Other;
23 }
24 if blocks.all(|bloc| bloc.count_blank_lines_at_start() > 0) {
25 Self::Between
26 } else {
27 Self::Other
28 }
29 }
30 pub fn apply(
31 self,
32 blocks: &mut [LocList],

Callers

nothing calls this directly

Calls 2

nextMethod · 0.80

Tested by

no test coverage detected