sqruff_lib_core/linter.rs
1use ahash::HashMapExt;
2use rustc_hash::FxHashMap;
3
4use crate::lint_fix::LintFix;
5use crate::segments::AnchorEditInfo;
6
7pub fn compute_anchor_edit_info(
8 fixes: impl Iterator<Item = LintFix>,
9) -> FxHashMap<u32, AnchorEditInfo> {
10 let mut anchor_info = FxHashMap::new();
11
12 for fix in fixes {
13 let anchor_id = fix.anchor.id();
14 anchor_info
15 .entry(anchor_id)
16 .or_insert_with(AnchorEditInfo::default)
17 .add(fix);
18 }
19
20 anchor_info
21}