aboutsummaryrefslogtreecommitdiff
path: root/maint/adhoc-add-lint-blocks
blob: 85af4156c6aee55c299b2f1f1f3a1f8f0dfb81f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env -S perl -i -p

# adhoc script for adding lint blocks to mod test everywhere
#
# git-grep -l 'cfg(test)' | xargs git-grep -L 'begin test lint list maintained by maint/add_warning' | xargs maint/adhoc-add-lint-blocks 
#
# TODO: this script should probably be deleted at some point, if we find we
# don't need to run it again.

next unless m{^mod test \{$} ... !m{^    \S};

if (m{^mod}) {
	$_ .= <<'END';
    // @@ begin test lint list maintained by maint/add_warning @@
    #![allow(clippy::bool_assert_comparison)]
    #![allow(clippy::clone_on_copy)]
    #![allow(clippy::dbg_macro)]
    #![allow(clippy::print_stderr)]
    #![allow(clippy::print_stdout)]
    #![allow(clippy::single_char_pattern)]
    #![allow(clippy::unwrap_used)]
    //! <!-- @@ end test lint list maintained by maint/add_warning @@ -->
END
}

s{^    \#\!\[allow\(clippy::.*\n}{};