Debian Codegraph @

src/lib.rs

raw symbols SCIP
1 use rowanrust-analyzer cargo rowan 0.16.1 crate/::{GreenNoderust-analyzer cargo rowan 0.16.1 green/node/GreenNode#, GreenNodeBuilderrust-analyzer cargo rowan 0.16.1 green/builder/GreenNodeBuilder#};
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/;
3
4 /// Check if an info string matches a pattern with wildcards
5 ///
6 /// Supports `*` wildcards in patterns like `[debian/copyright:*]` matching `[debian/copyright:31]`
7 /// The asterisk matches arbitrary strings similar to shell wildcards.
8 pub fn info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().(pattern: &str, value: &str) -> bool {
9 if pattern rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().value {
10 return true;
11 }
12
13 // Check if pattern contains wildcards
14 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().pattern.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().('*') {
15 return false;
16 }
17
18 // Split pattern by wildcards
19 let parts: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<&str> = pattern.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().('*').collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
20
21 // Check prefix (before first *)
22 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().parts[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().value.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().(parts[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().) {
23 return false;
24 }
25
26 // Check suffix (after last *)
27 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().parts[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().parts.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().value.ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]ends_with().(parts[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().parts.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().) {
28 return false;
29 }
30
31 // Check middle parts appear in order
32 let mut pos = parts[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().();
33 for part in &parts[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#parts.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). {
34 if part.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
35 continue;
36 }
37 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(found) = value[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().pos..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().(part) {
38 pos rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().found rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().part.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().();
39 } else {
40 return false;
41 }
42 }
43
44 true
45 }
46
47 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
48 #[allow(non_camel_case_types)]
49 #[repr(u16)]
50 /// Syntax kinds for lintian override files
51 pub enum SyntaxKindrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind# {
52 /// Whitespace token
53 WHITESPACErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#WHITESPACE# = 0,
54 /// Comment token
55 COMMENTrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#COMMENT#,
56 /// Package name token
57 PACKAGE_NAMErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_NAME#,
58 /// Left bracket token for Architecture
59 L_BRACKETrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#L_BRACKET#,
60 /// Right bracket token for Architecture
61 R_BRACKETrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#R_BRACKET#,
62 /// Single architecture token
63 ARCHrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#ARCH#,
64 /// Colon token
65 COLONrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#COLON#,
66 /// Package type token
67 PACKAGE_TYPErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_TYPE#,
68 /// Tag token
69 TAGrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#TAG#,
70 /// Info token
71 INFOrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#INFO#,
72 /// Newline token
73 NEWLINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#NEWLINE#,
74 /// Root node
75 ROOTrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#ROOT#,
76 /// Override line node
77 OVERRIDE_LINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#OVERRIDE_LINE#,
78 /// Package specification node
79 PACKAGE_SPECrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_SPEC#,
80 /// Error node
81 ERRORrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#ERROR#,
82 }
83
84 use SyntaxKindrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#::*;
85
86 /// The package type keywords valid in a lintian-overrides spec.
87 const PACKAGE_TYPESrust-analyzer cargo lintian-overrides 0.1.6 PACKAGE_TYPES.: &[&str] = &["source", "binary", "udeb"];
88
89 impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<SyntaxKindrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#> for rowanrust-analyzer cargo rowan 0.16.1 crate/::SyntaxKindrust-analyzer cargo rowan 0.16.1 green/SyntaxKind# {
90 fn fromrust-analyzer cargo lintian-overrides 0.1.6 impl#[`rowan::SyntaxKind`][`From<SyntaxKind>`]from().(kind: SyntaxKindrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#) -> Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[`rowan::SyntaxKind`][`From<SyntaxKind>`] {
91 Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[`rowan::SyntaxKind`][`From<SyntaxKind>`](kind as u16)
92 }
93 }
94
95 /// Language type for the lintian override parser
96 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialOrdrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd:, Ordrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Ord:, Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/macros/Hash:)]
97 pub enum Langrust-analyzer cargo lintian-overrides 0.1.6 Lang# {}
98
99 impl rowanrust-analyzer cargo rowan 0.16.1 crate/::Languagerust-analyzer cargo rowan 0.16.1 api/Language# for Langrust-analyzer cargo lintian-overrides 0.1.6 Lang# {
100 type Kindrust-analyzer cargo lintian-overrides 0.1.6 impl#[Lang][Language]Kind# = SyntaxKindrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#;
101
102 fn kind_from_rawrust-analyzer cargo lintian-overrides 0.1.6 impl#[Lang][Language]kind_from_raw().(raw: rowanrust-analyzer cargo rowan 0.16.1 crate/::SyntaxKindrust-analyzer cargo rowan 0.16.1 green/SyntaxKind#) -> Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[Lang][Language]::Kindrust-analyzer cargo rowan 0.16.1 api/Language#Kind# {
103 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(raw.0rust-analyzer cargo rowan 0.16.1 green/SyntaxKind#0. <= ERRORrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#ERROR# as u16);
104 unsafe { stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::transmuterust-analyzer cargo core https://github.com/rust-lang/rust/library/core intrinsics/transmute().::<u16, SyntaxKindrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#>(raw.0rust-analyzer cargo rowan 0.16.1 green/SyntaxKind#0.) }
105 }
106
107 fn kind_to_rawrust-analyzer cargo lintian-overrides 0.1.6 impl#[Lang][Language]kind_to_raw().(kind: Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[Lang][Language]::Kindrust-analyzer cargo rowan 0.16.1 api/Language#Kind#) -> rowanrust-analyzer cargo rowan 0.16.1 crate/::SyntaxKindrust-analyzer cargo rowan 0.16.1 green/SyntaxKind# {
108 kind.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().()
109 }
110 }
111
112 /// Syntax node type for lintian overrides
113 pub type SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode# = rowanrust-analyzer cargo rowan 0.16.1 crate/::SyntaxNoderust-analyzer cargo rowan 0.16.1 api/SyntaxNode#<Langrust-analyzer cargo lintian-overrides 0.1.6 Lang#>;
114 /// Syntax token type for lintian overrides
115 pub type SyntaxTokenrust-analyzer cargo lintian-overrides 0.1.6 SyntaxToken# = rowanrust-analyzer cargo rowan 0.16.1 crate/::SyntaxTokenrust-analyzer cargo rowan 0.16.1 api/SyntaxToken#<Langrust-analyzer cargo lintian-overrides 0.1.6 Lang#>;
116 /// Syntax element type for lintian overrides
117 pub type SyntaxElementrust-analyzer cargo lintian-overrides 0.1.6 SyntaxElement# = rowanrust-analyzer cargo rowan 0.16.1 crate/::NodeOrTokenrust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#<SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#, SyntaxTokenrust-analyzer cargo lintian-overrides 0.1.6 SyntaxToken#>;
118
119 /// The result of parsing a lintian-overrides file.
120 ///
121 /// `PartialEq` / `Eq` compare the underlying `GreenNode` (cheap —
122 /// rowan green nodes are interned) and the errors, so this type
123 /// can be stored in a Salsa database. The manual `Send` / `Sync`
124 /// impls assert that `Parse` itself is thread-safe even when `T`
125 /// (the AST node type) wraps a non-thread-safe `SyntaxNode`: the
126 /// only field carrying real data is the `GreenNode`, which is
127 /// thread-safe. The phantom `T` exists for type-tagging only.
128 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)]
129 pub struct Parserust-analyzer cargo lintian-overrides 0.1.6 Parse#<T> {
130 greenrust-analyzer cargo lintian-overrides 0.1.6 Parse#green.: GreenNoderust-analyzer cargo rowan 0.16.1 green/node/GreenNode#,
131 errorsrust-analyzer cargo lintian-overrides 0.1.6 Parse#errors.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
132 error_offsetsrust-analyzer cargo lintian-overrides 0.1.6 Parse#error_offsets.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#>,
133 _phantomrust-analyzer cargo lintian-overrides 0.1.6 Parse#_phantom.: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<T>,
134 }
135
136 // SAFETY: The only data Parse holds is the GreenNode (thread-safe
137 // — that's the whole point of rowan's red-green split) and the
138 // errors Vec. The PhantomData<T> contributes no runtime data.
139 unsafe impl<T> Sendrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Send# for Parserust-analyzer cargo lintian-overrides 0.1.6 Parse#<T> {}
140 unsafe impl<T> Syncrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sync# for Parserust-analyzer cargo lintian-overrides 0.1.6 Parse#<T> {}
141
142 impl<T> Parserust-analyzer cargo lintian-overrides 0.1.6 Parse#<T> {
143 fn newrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]new().(green: GreenNoderust-analyzer cargo rowan 0.16.1 green/node/GreenNode#, errors: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#)>) -> Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`] {
144 let (errors, error_offsets) = errors.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().unziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#unzip().();
145 Parserust-analyzer cargo lintian-overrides 0.1.6 Parse# {
146 greenrust-analyzer cargo lintian-overrides 0.1.6 Parse#green.,
147 errorsrust-analyzer cargo lintian-overrides 0.1.6 Parse#errors.,
148 error_offsetsrust-analyzer cargo lintian-overrides 0.1.6 Parse#error_offsets.,
149 _phantomrust-analyzer cargo lintian-overrides 0.1.6 Parse#_phantom.: stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#,
150 }
151 }
152
153 /// Get the syntax tree
154 pub fn syntaxrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]syntax().(&self) -> SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode# {
155 SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#::new_rootrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]new_root().(self.greenrust-analyzer cargo lintian-overrides 0.1.6 Parse#green..clonerust-analyzer cargo rowan 0.16.1 green/node/impl#[GreenNode][Clone]clone().())
156 }
157
158 /// Get the parse errors
159 pub fn errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().(&self) -> &[Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#] {
160 &self.errorsrust-analyzer cargo lintian-overrides 0.1.6 Parse#errors.
161 }
162
163 /// Get the parse errors together with their byte offsets in the source.
164 pub fn errors_with_offsetsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors_with_offsets().(&self) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = (&str, rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#)> {
165 self.errorsrust-analyzer cargo lintian-overrides 0.1.6 Parse#errors.
166 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
167 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|s| s.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().())
168 .ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#zip().(self.error_offsetsrust-analyzer cargo lintian-overrides 0.1.6 Parse#error_offsets..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().())
169 }
170
171 /// Convert to result, returning errors if any
172 pub fn okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().(self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>>
173 where
174 T: AstNoderust-analyzer cargo lintian-overrides 0.1.6 AstNode#,
175 {
176 if self.errorsrust-analyzer cargo lintian-overrides 0.1.6 Parse#errors..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
177 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(T::castrust-analyzer cargo lintian-overrides 0.1.6 AstNode#cast().(self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]syntax().()).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())
178 } else {
179 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(self.errorsrust-analyzer cargo lintian-overrides 0.1.6 Parse#errors.)
180 }
181 }
182
183 /// Return the parsed tree even when there are errors.
184 ///
185 /// Lintian-overrides parsing is resilient: the parser always
186 /// produces a green tree (well-formed lines + recovered tokens
187 /// for malformed ones), so consumers that want partial output —
188 /// LSP semantic tokens, completion lookups, hover — should walk
189 /// `tree()` rather than throwing the whole document away on the
190 /// first parse error via `ok()`.
191 pub fn treerust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]tree().(&self) -> T
192 where
193 T: AstNoderust-analyzer cargo lintian-overrides 0.1.6 AstNode#,
194 {
195 T::castrust-analyzer cargo lintian-overrides 0.1.6 AstNode#cast().(self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]syntax().()).expectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]expect().("root node has wrong type")
196 }
197 }
198
199 /// Trait for AST nodes
200 pub trait AstNoderust-analyzer cargo lintian-overrides 0.1.6 AstNode#: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# {
201 /// Cast a syntax node to this AST node type
202 fn castrust-analyzer cargo lintian-overrides 0.1.6 AstNode#cast().(syntax: SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Self>
203 where
204 Self: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#;
205
206 /// Get the underlying syntax node
207 fn syntaxrust-analyzer cargo lintian-overrides 0.1.6 AstNode#syntax().(&self) -> &SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#;
208 }
209
210 /// The root node of a lintian-overrides file
211 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)]
212 pub struct LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides# {
213 syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax.: SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#,
214 }
215
216 impl AstNoderust-analyzer cargo lintian-overrides 0.1.6 AstNode# for LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides# {
217 fn castrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides][AstNode]cast().(syntax: SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides][AstNode]> {
218 if syntax.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().ROOTrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#ROOT# {
219 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides][AstNode] { syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax. })
220 } else {
221 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
222 }
223 }
224
225 fn syntaxrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides][AstNode]syntax().(&self) -> &SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode# {
226 &self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax.
227 }
228 }
229
230 impl LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides# {
231 /// Capture an independent snapshot of this lintian-overrides file.
232 ///
233 /// The returned value shares the underlying immutable green-node data
234 /// with `self` at the time of the call, but lives in its own mutable
235 /// tree: subsequent mutations to `self` do not propagate to the snapshot.
236 /// Pair with [`Self::tree_eq`] to detect later mutations.
237 pub fn snapshotrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]snapshot().(&self) -> Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides] {
238 LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides# {
239 syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax.: SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#::new_root_mutrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]new_root_mut().(self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax..greenrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]green().().into_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/impl#[`Cow<'_, B>`]into_owned().()),
240 }
241 }
242
243 /// Returns true iff the syntax trees of `self` and `other` are
244 /// value-equal. An O(1) pointer-identity fast path makes this free for
245 /// trees that still share state with a recent `snapshot()`.
246 pub fn tree_eqrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]tree_eq().(&self, other: &Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]) -> bool {
247 let a = self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax..greenrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]green().();
248 let b = other.syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax..greenrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]green().();
249 let a_ref: &rowanrust-analyzer cargo rowan 0.16.1 crate/::GreenNodeDatarust-analyzer cargo rowan 0.16.1 green/node/GreenNodeData# = &a;
250 let b_ref: &rowanrust-analyzer cargo rowan 0.16.1 crate/::GreenNodeDatarust-analyzer cargo rowan 0.16.1 green/node/GreenNodeData# = &b;
251 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/eq().(a_ref as *const _, b_ref as *const _) || a_ref rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().b_ref
252 }
253
254 /// Parse a lintian-overrides file
255 pub fn parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text: &str) -> Parserust-analyzer cargo lintian-overrides 0.1.6 Parse#<Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]> {
256 let (green, errors) = parse_lintian_overridesrust-analyzer cargo lintian-overrides 0.1.6 parse_lintian_overrides().(text);
257 Parserust-analyzer cargo lintian-overrides 0.1.6 Parse#::newrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]new().(green, errors)
258 }
259
260 /// Get all override lines
261 pub fn linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().(&self) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = OverrideLinerust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#> + '_ {
262 self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax..childrenrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children().().filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(OverrideLinerust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#::castrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine][AstNode]cast().)
263 }
264
265 /// Return the package name of the override line at the given offset, if any.
266 pub fn package_name_at_offsetrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]package_name_at_offset().(&self, offset: rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
267 self.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().()
268 .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#find().(|line| line.syntaxrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine][AstNode]syntax().().text_rangerust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]text_range().().containsrust-analyzer cargo text-size 1.1.1 range/impl#[TextRange]contains().(offset))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().
269 .package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().()
270 .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]filter().(|spec| spec.contains_offsetrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]contains_offset().(offset))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().
271 .package_namerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_name().()
272 }
273
274 /// Convert back to text
275 pub fn textrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]text().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
276 self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax..textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]text().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()
277 }
278
279 /// Get a reference to the underlying syntax node
280 pub fn syntax_noderust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]syntax_node().(&self) -> &SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode# {
281 &self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax.
282 }
283 }
284
285 impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides# {
286 fn fmtrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
287 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax..textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]text().())
288 }
289 }
290
291 /// A single override line
292 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)]
293 pub struct OverrideLinerust-analyzer cargo lintian-overrides 0.1.6 OverrideLine# {
294 syntaxrust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#syntax.: SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#,
295 }
296
297 impl AstNoderust-analyzer cargo lintian-overrides 0.1.6 AstNode# for OverrideLinerust-analyzer cargo lintian-overrides 0.1.6 OverrideLine# {
298 fn castrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine][AstNode]cast().(syntax: SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine][AstNode]> {
299 if syntax.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().OVERRIDE_LINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#OVERRIDE_LINE# {
300 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine][AstNode] { syntaxrust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#syntax. })
301 } else {
302 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
303 }
304 }
305
306 fn syntaxrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine][AstNode]syntax().(&self) -> &SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode# {
307 &self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#syntax.
308 }
309 }
310
311 impl OverrideLinerust-analyzer cargo lintian-overrides 0.1.6 OverrideLine# {
312 /// Check if this line is a comment
313 pub fn is_commentrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]is_comment().(&self) -> bool {
314 self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#syntax.
315 .children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().()
316 .anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|it| matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(it.as_tokenrust-analyzer cargo rowan 0.16.1 utility_types/impl#[`NodeOrToken<N, T>`]as_token().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(token) if token.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().() == COMMENTrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#COMMENT#))
317 }
318
319 /// Check if this line is empty
320 pub fn is_emptyrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]is_empty().(&self) -> bool {
321 self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#syntax.
322 .children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().()
323 .allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(|it| matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(it.as_tokenrust-analyzer cargo rowan 0.16.1 utility_types/impl#[`NodeOrToken<N, T>`]as_token().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(token) if token.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().() == WHITESPACErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#WHITESPACE# || token.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().() == NEWLINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#NEWLINE#))
324 }
325
326 /// Whether this line carries a spec-terminating colon.
327 pub fn has_colonrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]has_colon().(&self) -> bool {
328 self.package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().()
329 }
330
331 /// Get the package specification if present
332 pub fn package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<PackageSpecrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec#> {
333 self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#syntax..childrenrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children().().find_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#find_map().(PackageSpecrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec#::castrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec][AstNode]cast().)
334 }
335
336 /// Get the tag token
337 pub fn tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<SyntaxTokenrust-analyzer cargo lintian-overrides 0.1.6 SyntaxToken#> {
338 self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#syntax.
339 .children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().()
340 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|it| it.into_tokenrust-analyzer cargo rowan 0.16.1 utility_types/impl#[`NodeOrToken<N, T>`]into_token().())
341 .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#find().(|it| it.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().TAGrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#TAG#)
342 }
343
344 /// Get the source range of the tag token, if present.
345 pub fn tag_rangerust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag_range().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<rowanrust-analyzer cargo rowan 0.16.1 crate/::TextRangerust-analyzer cargo text-size 1.1.1 range/TextRange#> {
346 self.tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|t| t.text_rangerust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text_range().())
347 }
348
349 /// Get the source range of this override line.
350 pub fn text_rangerust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]text_range().(&self) -> rowanrust-analyzer cargo rowan 0.16.1 crate/::TextRangerust-analyzer cargo text-size 1.1.1 range/TextRange# {
351 self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#syntax..text_rangerust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]text_range().()
352 }
353
354 /// Get the info text
355 pub fn inforust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]info().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
356 let tokens: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = self
357 .syntaxrust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#syntax.
358 .children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().()
359 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|it| it.into_tokenrust-analyzer cargo rowan 0.16.1 utility_types/impl#[`NodeOrToken<N, T>`]into_token().())
360 .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|it| it.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().INFOrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#INFO#)
361 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
362
363 if tokens.is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
364 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
365 } else {
366 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(
367 tokens
368 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
369 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|t| t.textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().())
370 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>()
371 .joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(" "),
372 )
373 }
374 }
375
376 /// Get the source range spanned by the info tokens, if any are present.
377 ///
378 /// When multiple `INFO` tokens are present the range spans from the start
379 /// of the first to the end of the last.
380 pub fn info_rangerust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]info_range().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<rowanrust-analyzer cargo rowan 0.16.1 crate/::TextRangerust-analyzer cargo text-size 1.1.1 range/TextRange#> {
381 let mut tokens = self
382 .syntaxrust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#syntax.
383 .children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().()
384 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|it| it.into_tokenrust-analyzer cargo rowan 0.16.1 utility_types/impl#[`NodeOrToken<N, T>`]into_token().())
385 .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|it| it.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().INFOrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#INFO#);
386 let first = tokens.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/filter/impl#[`Filter<I, P>`][Iterator]next().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().;
387 let last = tokens.lastrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#last().().unwrap_or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or_else().(|| first.clonerust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`][Clone]clone().());
388 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(first.text_rangerust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text_range().().coverrust-analyzer cargo text-size 1.1.1 range/impl#[TextRange]cover().(last.text_rangerust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text_range().()))
389 }
390
391 /// Get the package name from the package spec, if present.
392 pub fn packagerust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
393 self.package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..package_namerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_name().()
394 }
395
396 /// Get the text representation of this line
397 pub fn textrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]text().(&self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# {
398 self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#syntax..textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]text().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()
399 }
400
401 /// Get the package type from the package spec (e.g., "source", "binary", "udeb")
402 /// The package spec can be in format "package-name type:", "package-name [ archlist ] type", or just "type:"
403 pub fn package_typerust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_type().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
404 self.package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch()..package_typerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_type().()
405 }
406
407 /// Check if this override line matches a given issue described by its components.
408 ///
409 /// # Arguments
410 /// * `issue_tag` - The lintian tag to match against
411 /// * `issue_package` - The package name to match against
412 /// * `issue_package_type` - The package type (e.g. "source", "binary") to match against
413 /// * `issue_info` - Additional info to match against (supports wildcard matching)
414 pub fn matchesrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]matches().(
415 &self,
416 issue_tag: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>,
417 issue_package: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>,
418 issue_package_type: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>,
419 issue_info: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>,
420 ) -> bool {
421 // Check if tag matches
422 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(tag) = self.tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().() {
423 if Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(tag.textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().()) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().issue_tag {
424 return false;
425 }
426 } else {
427 return false;
428 }
429
430 // Check package name and/or type if specified in override
431 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pkg_spec) = self.package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().() {
432 // Match on package name if the override specifies one.
433 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pkg_name) = pkg_spec.package_namerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_name().() {
434 if Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pkg_name.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().issue_package {
435 return false;
436 }
437 }
438 // Match on package type if the override specifies one.
439 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pkg_type) = pkg_spec.package_typerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_type().() {
440 if Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pkg_type.as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().()) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().issue_package_type {
441 return false;
442 }
443 }
444 }
445
446 // Check info if present on the issue
447 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(our_info) = issue_info {
448 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(override_info) = self.inforust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]info().() {
449 let override_info = override_info.trimrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim().();
450 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().(override_info, our_info) {
451 return false;
452 }
453 }
454 }
455
456 true
457 }
458 }
459
460 /// Package specification (e.g., "package:" or "binary:")
461 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:)]
462 pub struct PackageSpecrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec# {
463 syntaxrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec#syntax.: SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#,
464 }
465
466 impl AstNoderust-analyzer cargo lintian-overrides 0.1.6 AstNode# for PackageSpecrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec# {
467 fn castrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec][AstNode]cast().(syntax: SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec][AstNode]> {
468 if syntax.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().PACKAGE_SPECrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_SPEC# {
469 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec][AstNode] { syntaxrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec#syntax. })
470 } else {
471 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#
472 }
473 }
474
475 fn syntaxrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec][AstNode]syntax().(&self) -> &SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode# {
476 &self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec#syntax.
477 }
478 }
479
480 impl PackageSpecrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec# {
481 /// Get the package name
482 pub fn package_namerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_name().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
483 self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec#syntax.
484 .children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().()
485 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|it| it.into_tokenrust-analyzer cargo rowan 0.16.1 utility_types/impl#[`NodeOrToken<N, T>`]into_token().())
486 .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#find().(|it| it.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().PACKAGE_NAMErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_NAME#)
487 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|t| t.textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
488 }
489
490 /// Get the package type (source or binary)
491 pub fn package_typerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_type().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
492 self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec#syntax.
493 .children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().()
494 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|it| it.into_tokenrust-analyzer cargo rowan 0.16.1 utility_types/impl#[`NodeOrToken<N, T>`]into_token().())
495 .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#find().(|it| it.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().PACKAGE_TYPErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_TYPE#)
496 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|t| t.textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
497 }
498
499 /// Get all architecture tokens inside the bracket list.
500 pub fn arch_listrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]arch_list().(&self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
501 self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec#syntax.
502 .children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().()
503 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|it| it.into_tokenrust-analyzer cargo rowan 0.16.1 utility_types/impl#[`NodeOrToken<N, T>`]into_token().())
504 .filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|it| it.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().ARCHrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#ARCH#)
505 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|t| t.textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
506 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
507 }
508
509 /// Whether the given offset falls within this package spec's text range.
510 pub fn contains_offsetrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]contains_offset().(&self, offset: rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#) -> bool {
511 self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec#syntax..text_rangerust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]text_range().().containsrust-analyzer cargo text-size 1.1.1 range/impl#[TextRange]contains().(offset)
512 }
513
514 /// Whether this spec has an architecture restriction list.
515 pub fn has_arch_listrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]has_arch_list().(&self) -> bool {
516 self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec#syntax.
517 .children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().()
518 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|it| it.into_tokenrust-analyzer cargo rowan 0.16.1 utility_types/impl#[`NodeOrToken<N, T>`]into_token().())
519 .anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|t| t.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().L_BRACKETrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#L_BRACKET#)
520 }
521
522 /// Whether `offset` falls within the `[ ... ]` architecture list,
523 pub fn arch_list_contains_offsetrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]arch_list_contains_offset().(&self, offset: rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#) -> bool {
524 let open = self
525 .syntaxrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec#syntax.
526 .children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().()
527 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|it| it.into_tokenrust-analyzer cargo rowan 0.16.1 utility_types/impl#[`NodeOrToken<N, T>`]into_token().())
528 .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#find().(|t| t.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().L_BRACKETrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#L_BRACKET#);
529 let close = self
530 .syntaxrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec#syntax.
531 .children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().()
532 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|it| it.into_tokenrust-analyzer cargo rowan 0.16.1 utility_types/impl#[`NodeOrToken<N, T>`]into_token().())
533 .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#find().(|t| t.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().R_BRACKETrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#R_BRACKET#);
534 match (open, close) {
535 (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(o), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c)) => {
536 offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().o.text_rangerust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text_range().().startrust-analyzer cargo text-size 1.1.1 range/impl#[TextRange]start().() && offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#le().c.text_rangerust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text_range().().startrust-analyzer cargo text-size 1.1.1 range/impl#[TextRange]start().()
537 }
538 // Brackets are always closed once a spec is recognised, but stay
539 // defensive: an open bracket alone still means "inside the list".
540 (Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(o), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialOrd#gt().o.text_rangerust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text_range().().startrust-analyzer cargo text-size 1.1.1 range/impl#[TextRange]start().(),
541 _ => false,
542 }
543 }
544
545 /// The text range of the package-type keyword (`source` / `binary` /
546 /// `udeb`), if present.
547 pub fn package_type_rangerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_type_range().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<rowanrust-analyzer cargo rowan 0.16.1 crate/::TextRangerust-analyzer cargo text-size 1.1.1 range/TextRange#> {
548 self.syntaxrust-analyzer cargo lintian-overrides 0.1.6 PackageSpec#syntax.
549 .children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().()
550 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|it| it.into_tokenrust-analyzer cargo rowan 0.16.1 utility_types/impl#[`NodeOrToken<N, T>`]into_token().())
551 .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#find().(|t| t.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().PACKAGE_TYPErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_TYPE#)
552 .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(|t| t.text_rangerust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text_range().())
553 }
554 }
555
556 /// Parse a lintian-overrides file.
557 ///
558 /// Parsing is resilient: a syntax tree is always produced, and malformed lines
559 /// are recorded as errors (with their byte offset) and wrapped in an ERROR
560 /// node so callers can do partial processing of the rest of the file.
561 fn parse_lintian_overridesrust-analyzer cargo lintian-overrides 0.1.6 parse_lintian_overrides().(text: &str) -> (GreenNoderust-analyzer cargo rowan 0.16.1 green/node/GreenNode#, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#)>) {
562 let mut builder = GreenNodeBuilderrust-analyzer cargo rowan 0.16.1 green/builder/GreenNodeBuilder#::newrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]new().();
563 let mut errors = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
564 let mut offset = rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#::fromrust-analyzer cargo text-size 1.1.1 size/impl#[TextSize][`From<u32>`]from().(0);
565
566 builder.start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(ROOTrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#ROOT#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
567
568 // split_inclusive keeps the trailing '\n' on each line if it was present,
569 // so we only emit a NEWLINE token when the source actually had one and
570 // round-trip back to exactly the input text.
571 for raw_line in text.split_inclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_inclusive().('\n') {
572 let (line, has_newline) = match raw_line.strip_suffixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_suffix().('\n') {
573 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(stripped) => (stripped, true),
574 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => (raw_line, false),
575 };
576 parse_linerust-analyzer cargo lintian-overrides 0.1.6 parse_line().(&mut builder, line, offset, &mut errors);
577 offset rust-analyzer cargo text-size 1.1.1 size/impl#[TextSize][`AddAssign<A>`]add_assign().+=rust-analyzer cargo text-size 1.1.1 size/impl#[TextSize][`AddAssign<A>`]add_assign(). rust-analyzer cargo text-size 1.1.1 size/impl#[TextSize][`AddAssign<A>`]add_assign().rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#::ofrust-analyzer cargo text-size 1.1.1 size/impl#[TextSize]of().(line);
578 if has_newline {
579 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(NEWLINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#NEWLINE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "\n");
580 offset rust-analyzer cargo text-size 1.1.1 size/impl#[TextSize][`AddAssign<A>`]add_assign().+=rust-analyzer cargo text-size 1.1.1 size/impl#[TextSize][`AddAssign<A>`]add_assign(). rust-analyzer cargo text-size 1.1.1 size/impl#[TextSize][`AddAssign<A>`]add_assign().rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#::fromrust-analyzer cargo text-size 1.1.1 size/impl#[TextSize][`From<u32>`]from().(1);
581 }
582 }
583
584 builder.finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
585 (builder.finishrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish().(), errors)
586 }
587
588 /// Build the OVERRIDE_LINE node for a single line.
589 ///
590 /// The line is lexed in one forward pass and the resulting tokens are grouped:
591 /// leading whitespace and everything from the tag onwards sit directly under
592 /// the line, while the package spec (up to and including its colon) is wrapped
593 /// in a PACKAGE_SPEC node. A non-empty, non-comment line that carries no tag,
594 /// or one with an unterminated arch bracket, is wrapped in an ERROR node and
595 /// recorded in `errors`.
596 fn parse_linerust-analyzer cargo lintian-overrides 0.1.6 parse_line().(
597 builder: &mut GreenNodeBuilderrust-analyzer cargo rowan 0.16.1 green/builder/GreenNodeBuilder#,
598 line: &str,
599 offset: rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#,
600 errors: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#)>,
601 ) {
602 builder.start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(OVERRIDE_LINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#OVERRIDE_LINE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
603
604 let lexed = lex_linerust-analyzer cargo lintian-overrides 0.1.6 lex_line().(line);
605 let has_content = lexed
606 .tokensrust-analyzer cargo lintian-overrides 0.1.6 LexedLine#tokens.
607 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
608 .anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]any().(|(kind, _)| !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(kind, WHITESPACErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#WHITESPACE# | COMMENTrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#COMMENT#));
609 let has_tag = lexed.tokensrust-analyzer cargo lintian-overrides 0.1.6 LexedLine#tokens..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]any().(|(kind, _)| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().TAGrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#TAG#);
610
611 // A line with content but no tag, or one with a lexing error, is malformed:
612 // record it and wrap its tokens in an ERROR node so the region is visible.
613 let error = lexed
614 .errorrust-analyzer cargo lintian-overrides 0.1.6 LexedLine#error.
615 .or_elserust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]or_else().(|| (has_content && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().has_tag).thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core bool/impl#[bool]then().(|| "missing lintian tag".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()));
616 let wrap_error = error.is_somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some().();
617 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(msg) = error {
618 errors.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((msg, offset));
619 }
620
621 // Leading whitespace stays directly under the override line.
622 let tokens = &lexed.tokensrust-analyzer cargo lintian-overrides 0.1.6 LexedLine#tokens.;
623 let mut start = 0;
624 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((WHITESPACErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#WHITESPACE#, ws)) = tokens.firstrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]first().() {
625 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(WHITESPACErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#WHITESPACE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), ws);
626 start = 1;
627 }
628
629 if wrap_error {
630 builder.start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(ERRORrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#ERROR#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
631 }
632
633 let body = &tokens[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
634 match body.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().positionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/iter/impl#[`Iter<'a, T>`][Iterator]position().(|(kind, _)| *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().COLONrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#COLON#) {
635 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(colon) => {
636 builder.start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(PACKAGE_SPECrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_SPEC#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
637 for (kind, text) in &body[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeToInclusive#colon]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). {
638 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().((*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), text);
639 }
640 builder.finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
641 for (kind, text) in &body[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().colon rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). {
642 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().((*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), text);
643 }
644 }
645 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => {
646 for (kind, text) in body {
647 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().((*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().kind).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), text);
648 }
649 }
650 }
651
652 if wrap_error {
653 builder.finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
654 }
655
656 builder.finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
657 }
658
659 /// The result of lexing a single line: its tokens and an optional error
660 /// message for a malformed line (e.g. an unterminated arch bracket).
661 struct LexedLinerust-analyzer cargo lintian-overrides 0.1.6 LexedLine#<'a> {
662 tokensrust-analyzer cargo lintian-overrides 0.1.6 LexedLine#tokens.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(SyntaxKindrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#, &'a str)>,
663 errorrust-analyzer cargo lintian-overrides 0.1.6 LexedLine#error.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
664 }
665
666 /// Lex a single line into a flat token stream in one forward pass.
667 ///
668 /// The line grammar is `[ws] package-spec? [ws] tag [ws info]?`, where
669 /// `package-spec = [name] [ws] ["[" archlist "]"] [ws] [type] ":"`.
670 ///
671 /// The colon is ambiguous: it only opens a package spec when the text up to it
672 /// is itself a valid spec (otherwise the colon belongs to the info, as in
673 /// `line 51:`). We resolve this by lexing the prefix speculatively; if the scan
674 /// reaches a terminating colon those tokens are kept, otherwise they are
675 /// dropped and the whole line is read as a bare tag plus info.
676 fn lex_linerust-analyzer cargo lintian-overrides 0.1.6 lex_line().(line: &str) -> LexedLinerust-analyzer cargo lintian-overrides 0.1.6 LexedLine#<'_> {
677 let mut tokens = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
678
679 let trimmed = line.trim_startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_start().();
680 let leading_ws = &line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#line.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().trimmed.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
681 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().leading_ws.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
682 tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((WHITESPACErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#WHITESPACE#, leading_ws));
683 }
684
685 if trimmed.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
686 return LexedLinerust-analyzer cargo lintian-overrides 0.1.6 LexedLine# {
687 tokensrust-analyzer cargo lintian-overrides 0.1.6 LexedLine#tokens.,
688 errorrust-analyzer cargo lintian-overrides 0.1.6 LexedLine#error.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
689 };
690 }
691 if trimmed.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('#') {
692 tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((COMMENTrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#COMMENT#, trimmed));
693 return LexedLinerust-analyzer cargo lintian-overrides 0.1.6 LexedLine# {
694 tokensrust-analyzer cargo lintian-overrides 0.1.6 LexedLine#tokens.,
695 errorrust-analyzer cargo lintian-overrides 0.1.6 LexedLine#error.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
696 };
697 }
698
699 // Try a leading package spec; fall back to treating the line as tag + info.
700 let mut error = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
701 let rest = match lex_package_specrust-analyzer cargo lintian-overrides 0.1.6 lex_package_spec().(trimmed) {
702 SpecScanrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#::Specrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#Spec#(spec, after) => {
703 tokens.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(spec);
704 after
705 }
706 SpecScanrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#::Unterminatedrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#Unterminated# => {
707 error = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("unterminated architecture list".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().());
708 trimmed
709 }
710 SpecScanrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#::Nonerust-analyzer cargo lintian-overrides 0.1.6 SpecScan#None# => trimmed,
711 };
712
713 // The remainder is [ws] tag [ws info]. Info may contain whitespace and
714 // colons, so it is a single token spanning to the end of the line.
715 let rest = push_wsrust-analyzer cargo lintian-overrides 0.1.6 push_ws().(&mut tokens, rest);
716 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().rest.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
717 let end = rest.findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().(char::is_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]is_whitespace().).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(rest.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().());
718 tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((TAGrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#TAG#, &rest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#end]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().));
719 let info = push_wsrust-analyzer cargo lintian-overrides 0.1.6 push_ws().(&mut tokens, &rest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().end..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
720 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().info.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
721 tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((INFOrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#INFO#, info));
722 }
723 }
724
725 LexedLinerust-analyzer cargo lintian-overrides 0.1.6 LexedLine# { tokensrust-analyzer cargo lintian-overrides 0.1.6 LexedLine#tokens., errorrust-analyzer cargo lintian-overrides 0.1.6 LexedLine#error. }
726 }
727
728 /// The outcome of scanning a line for a leading package spec.
729 enum SpecScanrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#<'a> {
730 /// A valid spec: its tokens and the remainder after the colon.
731 Specrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#Spec#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(SyntaxKindrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#, &'a str)>, &'a str),
732 /// A spec-like prefix with an opening `[` but no closing `]`.
733 Unterminatedrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#Unterminated#,
734 /// No package spec; the line is a bare tag plus info.
735 Nonerust-analyzer cargo lintian-overrides 0.1.6 SpecScan#None#,
736 }
737
738 /// Lex a leading package spec terminated by `:`.
739 fn lex_package_specrust-analyzer cargo lintian-overrides 0.1.6 lex_package_spec().(line: &str) -> SpecScanrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#<'_> {
740 let mut tokens = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
741 let mut rest = line;
742
743 // Optional package name. A lone type keyword denotes the type, not a name,
744 // so a bare type keyword directly before the colon is emitted as the type.
745 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().rest.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('[') {
746 let end = rest
747 .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().(|c: char| c.is_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]is_whitespace().() || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().'[' || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().':')
748 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(rest.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().());
749 let word = &rest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#end]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
750 let after = rest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().end..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..trim_startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_start().();
751 if word.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
752 return SpecScanrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#::Nonerust-analyzer cargo lintian-overrides 0.1.6 SpecScan#None#;
753 }
754 if PACKAGE_TYPESrust-analyzer cargo lintian-overrides 0.1.6 PACKAGE_TYPES..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&word) && after.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().(':') {
755 tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((PACKAGE_TYPErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_TYPE#, word));
756 return finish_specrust-analyzer cargo lintian-overrides 0.1.6 finish_spec().(tokens, after);
757 }
758 tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((PACKAGE_NAMErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_NAME#, word));
759 rest = push_wsrust-analyzer cargo lintian-overrides 0.1.6 push_ws().(&mut tokens, &rest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().end..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
760 }
761
762 // Optional architecture list enclosed in brackets. An opening bracket that
763 // is part of a spec-like line but is never closed is a malformed spec, not
764 // info that happens to contain a `[`.
765 if rest.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('[') {
766 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(end) = rest.findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().(']') else {
767 return SpecScanrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#::Unterminatedrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#Unterminated#;
768 };
769 tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((L_BRACKETrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#L_BRACKET#, "["));
770 let mut arch = &rest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#end]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
771 loop {
772 arch = push_wsrust-analyzer cargo lintian-overrides 0.1.6 push_ws().(&mut tokens, arch);
773 if arch.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
774 break;
775 }
776 let word_end = arch.findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().(char::is_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]is_whitespace().).unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(arch.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().());
777 tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((ARCHrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#ARCH#, &arch[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#word_end]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().));
778 arch = &arch[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().word_end..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
779 }
780 tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((R_BRACKETrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#R_BRACKET#, "]"));
781 rest = push_wsrust-analyzer cargo lintian-overrides 0.1.6 push_ws().(&mut tokens, &rest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().end rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
782 }
783
784 // Optional trailing package type keyword.
785 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().rest.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().(':') {
786 let end = rest
787 .findrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]find().(|c: char| c.is_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]is_whitespace().() || c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]eq().':')
788 .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(rest.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().());
789 let word = &rest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#end]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
790 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().PACKAGE_TYPESrust-analyzer cargo lintian-overrides 0.1.6 PACKAGE_TYPES..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&word) {
791 return SpecScanrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#::Nonerust-analyzer cargo lintian-overrides 0.1.6 SpecScan#None#;
792 }
793 tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((PACKAGE_TYPErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_TYPE#, word));
794 rest = push_wsrust-analyzer cargo lintian-overrides 0.1.6 push_ws().(&mut tokens, &rest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().end..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().);
795 }
796
797 finish_specrust-analyzer cargo lintian-overrides 0.1.6 finish_spec().(tokens, rest)
798 }
799
800 /// Commit the spec when `rest` starts with the terminating colon. A spec colon
801 /// is followed by whitespace or end of line; a colon glued to more text (e.g.
802 /// `foo:bar`) is info, not a spec terminator.
803 fn finish_specrust-analyzer cargo lintian-overrides 0.1.6 finish_spec().<'a>(mut tokens: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(SyntaxKindrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#, &'a str)>, rest: &'a str) -> SpecScanrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#<'a> {
804 let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(after) = rest.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().(':') else {
805 return SpecScanrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#::Nonerust-analyzer cargo lintian-overrides 0.1.6 SpecScan#None#;
806 };
807 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().after.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().after.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().(char::is_whitespacerust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]is_whitespace().) {
808 return SpecScanrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#::Nonerust-analyzer cargo lintian-overrides 0.1.6 SpecScan#None#;
809 }
810 tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((COLONrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#COLON#, ":"));
811 SpecScanrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#::Specrust-analyzer cargo lintian-overrides 0.1.6 SpecScan#Spec#(tokens, after)
812 }
813
814 /// Split leading whitespace off `rest`, emit it as a WHITESPACE token, and
815 /// return the remainder.
816 fn push_wsrust-analyzer cargo lintian-overrides 0.1.6 push_ws().<'a>(tokens: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(SyntaxKindrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#, &'a str)>, rest: &'a str) -> &'a str {
817 let trimmed = rest.trim_startrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]trim_start().();
818 let ws = &rest[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeTo#rest.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().trimmed.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().()]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().;
819 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().ws.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
820 tokens.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().((WHITESPACErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#WHITESPACE#, ws));
821 }
822 trimmed
823 }
824
825 /// Builder for creating/modifying lintian-overrides files
826 pub struct LintianOverridesBuilderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#<'a> {
827 builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder.: GreenNodeBuilderrust-analyzer cargo rowan 0.16.1 green/builder/GreenNodeBuilder#<'a>,
828 }
829
830 impl<'a> LintianOverridesBuilderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#<'a> {
831 /// Create a new builder
832 pub fn newrust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`]new().() -> Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`] {
833 let mut builder = GreenNodeBuilderrust-analyzer cargo rowan 0.16.1 green/builder/GreenNodeBuilder#::newrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]new().();
834 builder.start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(ROOTrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#ROOT#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
835 Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`] { builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder. }
836 }
837
838 /// Add a comment line
839 pub fn add_commentrust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`]add_comment().(&mut self, text: &str) -> &mut Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`] {
840 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(OVERRIDE_LINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#OVERRIDE_LINE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
841 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(COMMENTrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#COMMENT#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), text);
842 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
843 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(NEWLINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#NEWLINE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "\n");
844 self
845 }
846
847 /// Add an override line
848 pub fn add_overriderust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`]add_override().(
849 &mut self,
850 package: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>,
851 tag: &str,
852 info: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>,
853 ) -> &mut Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`] {
854 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(OVERRIDE_LINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#OVERRIDE_LINE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
855
856 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pkg) = package {
857 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(PACKAGE_SPECrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_SPEC#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
858 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(PACKAGE_NAMErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_NAME#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), pkg);
859 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(COLONrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#COLON#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), ":");
860 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
861 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(WHITESPACErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#WHITESPACE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), " ");
862 }
863
864 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(TAGrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#TAG#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), tag);
865
866 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(info_text) = info {
867 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(WHITESPACErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#WHITESPACE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), " ");
868 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(INFOrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#INFO#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), info_text);
869 }
870
871 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
872 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(NEWLINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#NEWLINE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "\n");
873 self
874 }
875
876 /// Finish building and return the LintianOverrides
877 pub fn finishrust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`]finish().(mut self) -> LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides# {
878 self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
879 let green = self.builderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#builder..finishrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish().();
880 LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides# {
881 syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax.: SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#::new_rootrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]new_root().(green),
882 }
883 }
884 }
885
886 impl<'a> Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default# for LintianOverridesBuilderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#<'a> {
887 fn defaultrust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`][Default]default().() -> Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`][Default] {
888 Selfrust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`][Default]::newrust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`]new().()
889 }
890 }
891
892 /// Copy a syntax node into a green node builder
893 pub fn copy_noderust-analyzer cargo lintian-overrides 0.1.6 copy_node().(builder: &mut GreenNodeBuilderrust-analyzer cargo rowan 0.16.1 green/builder/GreenNodeBuilder#, node: &SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#) {
894 builder.start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(node.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]kind().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
895 for child in node.children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().() {
896 match child {
897 rowanrust-analyzer cargo rowan 0.16.1 crate/::NodeOrTokenrust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#::Tokenrust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#Token#(token) => {
898 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(token.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), token.textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().());
899 }
900 rowanrust-analyzer cargo rowan 0.16.1 crate/::NodeOrTokenrust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#::Noderust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#Node#(child_node) => {
901 copy_noderust-analyzer cargo lintian-overrides 0.1.6 copy_node().(builder, &child_node);
902 }
903 }
904 }
905 builder.finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
906 }
907
908 /// Filter override lines based on a predicate
909 pub fn filter_overridesrust-analyzer cargo lintian-overrides 0.1.6 filter_overrides().<F>(overrides: &LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#, mut predicate: F) -> LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#
910 where
911 F: FnMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnMut#(&OverrideLinerust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#) -> bool,
912 {
913 let mut builder = GreenNodeBuilderrust-analyzer cargo rowan 0.16.1 green/builder/GreenNodeBuilder#::newrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]new().();
914 builder.start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(ROOTrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#ROOT#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
915
916 for line_node in overrides.syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax..childrenrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children().() {
917 if line_node.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().OVERRIDE_LINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#OVERRIDE_LINE# {
918 let line = OverrideLinerust-analyzer cargo lintian-overrides 0.1.6 OverrideLine# {
919 syntaxrust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#syntax.: line_node.clonerust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`][Clone]clone().(),
920 };
921
922 if predicate(&line) {
923 copy_noderust-analyzer cargo lintian-overrides 0.1.6 copy_node().(&mut builder, &line_node);
924 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(NEWLINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#NEWLINE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "\n");
925 }
926 }
927 }
928
929 builder.finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
930 let green = builder.finishrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish().();
931 LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides# {
932 syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax.: SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#::new_rootrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]new_root().(green),
933 }
934 }
935
936 /// Rebuild `overrides` with each line's TAG token rewritten by `rename`.
937 ///
938 /// Lines whose tag is unchanged keep their original tokens (whitespace,
939 /// comments, package spec) verbatim — only the TAG token is replaced.
940 /// `rename` is invoked once per override line that has a tag, and should
941 /// return the new tag text, or `None` to leave the tag as-is.
942 ///
943 /// # Example
944 /// ```
945 /// use lintian_overrides::{LintianOverrides, rename_tags};
946 /// let parsed = LintianOverrides::parse("# keep\nold-tag info\n");
947 /// let overrides = parsed.ok().unwrap();
948 /// let renamed = rename_tags(&overrides, |tag| {
949 /// if tag == "old-tag" { Some("new-tag".to_string()) } else { None }
950 /// });
951 /// assert_eq!(renamed.text(), "# keep\nnew-tag info\n");
952 /// ```
953 pub fn rename_tagsrust-analyzer cargo lintian-overrides 0.1.6 rename_tags().<F>(overrides: &LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#, mut rename: F) -> LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#
954 where
955 F: FnMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnMut#(&str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>,
956 {
957 let mut builder = GreenNodeBuilderrust-analyzer cargo rowan 0.16.1 green/builder/GreenNodeBuilder#::newrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]new().();
958 builder.start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(ROOTrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#ROOT#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
959
960 for child in overrides.syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax..children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().() {
961 match child {
962 rowanrust-analyzer cargo rowan 0.16.1 crate/::NodeOrTokenrust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#::Noderust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#Node#(node) if node.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().OVERRIDE_LINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#OVERRIDE_LINE# => {
963 let line = OverrideLinerust-analyzer cargo lintian-overrides 0.1.6 OverrideLine# {
964 syntaxrust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#syntax.: node.clonerust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`][Clone]clone().(),
965 };
966 let new_tag = line.tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().().and_thenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]and_then().(|t| rename(t.textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().()));
967 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(new_tag) = new_tag {
968 builder.start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(OVERRIDE_LINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#OVERRIDE_LINE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
969 for element in line.syntaxrust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#syntax..children_with_tokensrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]children_with_tokens().() {
970 match element {
971 rowanrust-analyzer cargo rowan 0.16.1 crate/::NodeOrTokenrust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#::Tokenrust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#Token#(token) if token.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().TAGrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#TAG# => {
972 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(TAGrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#TAG#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), &new_tag);
973 }
974 rowanrust-analyzer cargo rowan 0.16.1 crate/::NodeOrTokenrust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#::Tokenrust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#Token#(token) => {
975 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(token.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), token.textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().());
976 }
977 rowanrust-analyzer cargo rowan 0.16.1 crate/::NodeOrTokenrust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#::Noderust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#Node#(child_node) => {
978 copy_noderust-analyzer cargo lintian-overrides 0.1.6 copy_node().(&mut builder, &child_node);
979 }
980 }
981 }
982 builder.finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
983 } else {
984 copy_noderust-analyzer cargo lintian-overrides 0.1.6 copy_node().(&mut builder, &node);
985 }
986 }
987 rowanrust-analyzer cargo rowan 0.16.1 crate/::NodeOrTokenrust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#::Noderust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#Node#(node) => {
988 copy_noderust-analyzer cargo lintian-overrides 0.1.6 copy_node().(&mut builder, &node);
989 }
990 rowanrust-analyzer cargo rowan 0.16.1 crate/::NodeOrTokenrust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#::Tokenrust-analyzer cargo rowan 0.16.1 utility_types/NodeOrToken#Token#(token) => {
991 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(token.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]kind().().intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), token.textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().());
992 }
993 }
994 }
995
996 builder.finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
997 let green = builder.finishrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish().();
998 LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides# {
999 syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax.: SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#::new_rootrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]new_root().(green),
1000 }
1001 }
1002
1003 /// Map override lines using a transformation function
1004 /// Returns a new LintianOverrides with the lines transformed by the function
1005 /// If the function returns None, the original line is kept unchanged
1006 pub fn map_overridesrust-analyzer cargo lintian-overrides 0.1.6 map_overrides().<F>(overrides: &LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#, mut transform: F) -> LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#
1007 where
1008 F: FnMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnMut#(&OverrideLinerust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>)>,
1009 {
1010 let mut builder = GreenNodeBuilderrust-analyzer cargo rowan 0.16.1 green/builder/GreenNodeBuilder#::newrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]new().();
1011 builder.start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(ROOTrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#ROOT#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
1012
1013 for line in overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().() {
1014 // Try to transform the line
1015 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((package, package_type, tag, info)) = transform(&line) {
1016 // Build a new override line with the transformed values
1017 builder.start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(OVERRIDE_LINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#OVERRIDE_LINE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
1018
1019 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(pkg) = package {
1020 builder.start_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]start_node().(PACKAGE_SPECrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_SPEC#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().());
1021 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(PACKAGE_NAMErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_NAME#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), &pkg);
1022 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ptype) = package_type {
1023 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(WHITESPACErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#WHITESPACE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), " ");
1024 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(PACKAGE_TYPErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#PACKAGE_TYPE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), &ptype);
1025 }
1026 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(COLONrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#COLON#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), ":");
1027 builder.finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
1028 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(WHITESPACErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#WHITESPACE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), " ");
1029 }
1030
1031 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(TAGrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#TAG#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), &tag);
1032
1033 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(info_text) = info {
1034 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(WHITESPACErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#WHITESPACE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), " ");
1035 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(INFOrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#INFO#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), &info_text);
1036 }
1037
1038 builder.finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
1039 } else {
1040 // Keep the original line unchanged
1041 copy_noderust-analyzer cargo lintian-overrides 0.1.6 copy_node().(&mut builder, line.syntaxrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine][AstNode]syntax().());
1042 }
1043 builder.tokenrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]token().(NEWLINErust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#NEWLINE#.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().(), "\n");
1044 }
1045
1046 builder.finish_noderust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish_node().();
1047 let green = builder.finishrust-analyzer cargo rowan 0.16.1 green/builder/impl#[`GreenNodeBuilder<'_>`]finish().();
1048 LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides# {
1049 syntaxrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#syntax.: SyntaxNoderust-analyzer cargo lintian-overrides 0.1.6 SyntaxNode#::new_rootrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]new_root().(green),
1050 }
1051 }
1052
1053 /// Find all lintian-overrides files in a debian directory.
1054 ///
1055 /// Returns the `debian/source/lintian-overrides` file (if present) followed
1056 /// by every `debian/*.lintian-overrides` file. An I/O error reading the
1057 /// `debian` directory is propagated rather than silently treated as "no
1058 /// override files": a caller that uses overrides to suppress a fix must not
1059 /// mistake an unreadable directory for an absent one.
1060 pub fn try_find_override_filesrust-analyzer cargo lintian-overrides 0.1.6 try_find_override_files().(
1061 base_path: &stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#,
1062 ) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>> {
1063 let mut files = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
1064
1065 let source_overrides = base_path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("debian/source/lintian-overrides");
1066 if source_overrides.existsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]exists().() {
1067 files.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(source_overrides);
1068 }
1069
1070 let debian_dir = base_path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("debian");
1071 match stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::read_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_dir().(&debian_dir) {
1072 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(entries) => {
1073 for entry in entries {
1074 let entry = entry?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1075 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(filename) = entry.file_namerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]file_name().().to_strrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsStr]to_str().() {
1076 if filename.ends_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]ends_with().(".lintian-overrides") {
1077 files.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(entry.pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/impl#[DirEntry]path().());
1078 }
1079 }
1080 }
1081 }
1082 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) if e.kindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]kind().() rust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[ErrorKind][`PartialEq<Self>`]eq().==rust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[ErrorKind][`PartialEq<Self>`]eq(). rust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[ErrorKind][`PartialEq<Self>`]eq().stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::NotFoundrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#NotFound# => {}
1083 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e),
1084 }
1085
1086 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(files)
1087 }
1088
1089 /// Collect all lintian override lines in a debian directory.
1090 ///
1091 /// An I/O error finding or reading any override file is propagated. This
1092 /// matters for callers that decide whether to apply a fix: silently
1093 /// dropping an unreadable override would treat the issue as un-suppressed
1094 /// and apply a change the maintainer had overridden. Parse errors within a
1095 /// file are tolerated, since the resilient parser still yields every
1096 /// well-formed line, so a malformed sibling line does not discard valid
1097 /// overrides.
1098 pub fn try_iter_overridesrust-analyzer cargo lintian-overrides 0.1.6 try_iter_overrides().(base_path: &stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Resultrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<OverrideLinerust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#>> {
1099 let mut lines = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().();
1100 for override_file in try_find_override_filesrust-analyzer cargo lintian-overrides 0.1.6 try_find_override_files().(base_path)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch(). {
1101 let content = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::read_to_stringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/read_to_string().(&override_file)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().;
1102 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(&content);
1103 lines.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(parsed.treerust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]tree().().linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().());
1104 }
1105 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(lines)
1106 }
1107
1108 /// Find all lintian-overrides files in a debian directory.
1109 ///
1110 /// Deprecated: this silently discards any I/O error reading the `debian`
1111 /// directory, so an unreadable directory is indistinguishable from an
1112 /// absent one. Use [`try_find_override_files`] instead.
1113 #[deprecated(
1114 since = "0.1.6",
1115 note = "silently swallows I/O errors; use try_find_override_files"
1116 )]
1117 pub fn find_override_filesrust-analyzer cargo lintian-overrides 0.1.6 find_override_files().(base_path: &stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#> {
1118 try_find_override_filesrust-analyzer cargo lintian-overrides 0.1.6 try_find_override_files().(base_path).unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_default().()
1119 }
1120
1121 /// Iterate over all lintian override lines in a debian directory.
1122 ///
1123 /// Deprecated: this silently drops any override file it cannot read, so a
1124 /// caller relying on an override to suppress a fix may apply the change
1125 /// anyway. Use [`try_iter_overrides`] instead.
1126 #[deprecated(
1127 since = "0.1.6",
1128 note = "silently swallows I/O errors; use try_iter_overrides"
1129 )]
1130 pub fn iter_overridesrust-analyzer cargo lintian-overrides 0.1.6 iter_overrides().(base_path: &stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#) -> impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = OverrideLinerust-analyzer cargo lintian-overrides 0.1.6 OverrideLine#> {
1131 try_iter_overridesrust-analyzer cargo lintian-overrides 0.1.6 try_iter_overrides().(base_path)
1132 .unwrap_or_defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_or_default().()
1133 .into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().()
1134 }
1135
1136 #[cfg(test)]
1137 mod testsrust-analyzer cargo lintian-overrides 0.1.6 tests/ {
1138 use superrust-analyzer cargo lintian-overrides 0.1.6 crate/::*;
1139
1140 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1141 fn test_info_matches_exactrust-analyzer cargo lintian-overrides 0.1.6 tests/test_info_matches_exact().() {
1142 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("foo", "foo"));
1143 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("foo", "bar"));
1144 }
1145
1146 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1147 fn test_info_matches_wildcard_simplerust-analyzer cargo lintian-overrides 0.1.6 tests/test_info_matches_wildcard_simple().() {
1148 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("*", "anything"));
1149 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("*", ""));
1150 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("**", "anything"));
1151 }
1152
1153 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1154 fn test_info_matches_wildcard_prefixrust-analyzer cargo lintian-overrides 0.1.6 tests/test_info_matches_wildcard_prefix().() {
1155 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("*.js", "file.js"));
1156 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("*.js", "path/to/file.js"));
1157 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("*.js", "file.css"));
1158 }
1159
1160 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1161 fn test_info_matches_wildcard_suffixrust-analyzer cargo lintian-overrides 0.1.6 tests/test_info_matches_wildcard_suffix().() {
1162 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("debian/*", "debian/control"));
1163 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("debian/*", "debian/rules"));
1164 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("debian/*", "other/file"));
1165 }
1166
1167 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1168 fn test_info_matches_wildcard_middlerust-analyzer cargo lintian-overrides 0.1.6 tests/test_info_matches_wildcard_middle().() {
1169 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().(
1170 "[debian/copyright:*]",
1171 "[debian/copyright:31]"
1172 ));
1173 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().(
1174 "[debian/copyright:*]",
1175 "[debian/copyright:100]"
1176 ));
1177 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("[debian/copyright:*]", "[debian/rules:31]"));
1178 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("[debian/copyright:*]", "debian/copyright:31"));
1179 }
1180
1181 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1182 fn test_info_matches_multiple_wildcardsrust-analyzer cargo lintian-overrides 0.1.6 tests/test_info_matches_multiple_wildcards().() {
1183 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("*.html.*.js", "foo.html.bar.js"));
1184 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("*.html.*.js", "foo.html.baz.qux.js"));
1185 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("*.html.*.js", "foo.css.bar.js"));
1186 }
1187
1188 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1189 fn test_info_matches_wildcard_empty_partsrust-analyzer cargo lintian-overrides 0.1.6 tests/test_info_matches_wildcard_empty_parts().() {
1190 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("foo**bar", "foobar"));
1191 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(info_matchesrust-analyzer cargo lintian-overrides 0.1.6 info_matches().("foo**bar", "fooxyzbar"));
1192 }
1193
1194 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1195 fn test_parse_simple_overriderust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_simple_override().() {
1196 let text = "some-tag\n";
1197 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1198 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parsed.errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
1199
1200 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1201 let lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1202
1203 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1);
1204 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().(), "some-tag");
1205 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..inforust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]info().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
1206 }
1207
1208 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1209 fn test_parse_override_with_inforust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_override_with_info().() {
1210 let text = "some-tag some extra info\n";
1211 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1212 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parsed.errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
1213
1214 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1215 let lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1216
1217 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1);
1218 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().(), "some-tag");
1219 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..inforust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]info().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("some extra info".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()));
1220 }
1221
1222 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1223 fn test_parse_package_overriderust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_package_override().() {
1224 let text = "package-name: some-tag\n";
1225 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1226 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parsed.errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
1227
1228 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1229 let lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1230
1231 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1);
1232 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().(), "some-tag");
1233 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1234 lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().package_namerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_name().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
1235 "package-name"
1236 );
1237 }
1238
1239 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1240 fn test_parse_commentrust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_comment().() {
1241 let text = "# This is a comment\nsome-tag\n";
1242 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1243 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parsed.errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
1244
1245 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1246 let lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1247
1248 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 2);
1249 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..is_commentrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]is_comment().());
1250 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().(), "some-tag");
1251 }
1252
1253 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1254 fn test_roundtriprust-analyzer cargo lintian-overrides 0.1.6 tests/test_roundtrip().() {
1255 let text = "# Comment\npackage: some-tag info\nanother-tag\n";
1256 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1257 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parsed.errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
1258
1259 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1260 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overrides.textrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]text().(), text);
1261 }
1262
1263 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1264 fn test_builderrust-analyzer cargo lintian-overrides 0.1.6 tests/test_builder().() {
1265 let mut builder = LintianOverridesBuilderrust-analyzer cargo lintian-overrides 0.1.6 LintianOverridesBuilder#::newrust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`]new().();
1266 builder.add_commentrust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`]add_comment().("# Test comment");
1267 builder.add_overriderust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`]add_override().(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("mypackage"), "some-tag", Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("with info"));
1268 builder.add_overriderust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`]add_override().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, "another-tag", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
1269 let overrides = builder.finishrust-analyzer cargo lintian-overrides 0.1.6 impl#[`LintianOverridesBuilder<'a>`]finish().();
1270
1271 let text = overrides.textrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]text().();
1272 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(text.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().("# Test comment"));
1273 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(text.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().("mypackage: some-tag with info"));
1274 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(text.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().("another-tag"));
1275 }
1276
1277 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1278 fn test_parse_info_with_colonrust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_info_with_colon().() {
1279 // Test that info fields containing colons are parsed correctly
1280 // This was a bug where "X-Python-Version: >= 2.5" would be misparsed
1281 let text = "ancient-python-version-field X-Python-Version: >= 2.5\n";
1282 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1283 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parsed.errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
1284
1285 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1286 let lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1287
1288 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1);
1289 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1290 lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().(),
1291 "ancient-python-version-field"
1292 );
1293 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1294 lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..inforust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]info().(),
1295 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("X-Python-Version: >= 2.5".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
1296 );
1297 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
1298 }
1299
1300 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1301 fn test_parse_source_prefix_with_info_containing_colonrust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_source_prefix_with_info_containing_colon().() {
1302 // Test parsing with explicit "source:" prefix and info containing colon
1303 let text = "source: ancient-python-version-field X-Python-Version: >= 2.5\n";
1304 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1305 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parsed.errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
1306
1307 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1308 let lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1309
1310 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1);
1311 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1312 lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().(),
1313 "ancient-python-version-field"
1314 );
1315 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1316 lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..inforust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]info().(),
1317 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("X-Python-Version: >= 2.5".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
1318 );
1319
1320 // A bare "source" prefix is the package type, not a package name.
1321 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().package_namerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_name().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
1322 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1323 lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().package_typerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_type().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
1324 "source"
1325 );
1326 }
1327
1328 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1329 fn test_bare_source_type_matches_source_issuerust-analyzer cargo lintian-overrides 0.1.6 tests/test_bare_source_type_matches_source_issue().() {
1330 // A "source: tag info" override has no package name; it must match a
1331 // source-type issue whose package is unspecified.
1332 let text = "source: debian-files-list-in-source debian/files\n";
1333 let overrides = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text).okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1334 let line = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/filter_map/impl#[`FilterMap<I, F>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
1335
1336 let spec = line.package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
1337 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(spec.package_namerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_name().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
1338 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(spec.package_typerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_type().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "source");
1339
1340 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(line.matchesrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]matches().(
1341 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("debian-files-list-in-source"),
1342 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
1343 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("source"),
1344 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("debian/files"),
1345 ));
1346 }
1347
1348 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1349 fn test_named_source_package_specrust-analyzer cargo lintian-overrides 0.1.6 tests/test_named_source_package_spec().() {
1350 // "foo source: tag" names package foo of type source.
1351 let text = "foo source: some-tag\n";
1352 let overrides = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text).okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1353 let line = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/adapters/filter_map/impl#[`FilterMap<I, F>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
1354
1355 let spec = line.package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().();
1356 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(spec.package_namerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_name().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "foo");
1357 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(spec.package_typerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_type().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "source");
1358 }
1359
1360 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1361 fn test_parse_two_word_non_package_specrust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_two_word_non_package_spec().() {
1362 // Test that two words before a colon that don't match package spec pattern
1363 // are not treated as a package spec
1364 let text = "some-tag field-name: value\n";
1365 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1366 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parsed.errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
1367
1368 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1369 let lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1370
1371 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1);
1372 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().(), "some-tag");
1373 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..inforust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]info().(), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("field-name: value".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()));
1374 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
1375 }
1376
1377 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1378 fn test_filter_overrides_preserves_newlinesrust-analyzer cargo lintian-overrides 0.1.6 tests/test_filter_overrides_preserves_newlines().() {
1379 let text = "# Comment\ntag1\ntag2\ntag3\n";
1380 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1381 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1382
1383 // Filter out tag2
1384 let filtered = filter_overridesrust-analyzer cargo lintian-overrides 0.1.6 filter_overrides().(&overrides, |line| {
1385 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(tag) = line.tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().() {
1386 tag.textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne()."tag2"
1387 } else {
1388 true // Keep comments and empty lines
1389 }
1390 });
1391
1392 let result = filtered.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().();
1393 let expected = "# Comment\ntag1\ntag3\n";
1394
1395 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1396 result, expected,
1397 "Newlines should be preserved after filtering"
1398 );
1399 }
1400
1401 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1402 fn test_rename_tags_preserves_structurerust-analyzer cargo lintian-overrides 0.1.6 tests/test_rename_tags_preserves_structure().() {
1403 let text = "# keep this comment\npkg source: old-tag some info\nother-tag\n";
1404 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1405 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1406 let renamed = rename_tagsrust-analyzer cargo lintian-overrides 0.1.6 rename_tags().(&overrides, |tag| match tag {
1407 "old-tag" => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("new-tag".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()),
1408 _ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#,
1409 });
1410 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1411 renamed.textrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]text().(),
1412 "# keep this comment\npkg source: new-tag some info\nother-tag\n"
1413 );
1414 }
1415
1416 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1417 fn test_rename_tags_no_match_no_changerust-analyzer cargo lintian-overrides 0.1.6 tests/test_rename_tags_no_match_no_change().() {
1418 let text = "tag1\ntag2\n";
1419 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1420 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1421 let renamed = rename_tagsrust-analyzer cargo lintian-overrides 0.1.6 rename_tags().(&overrides, |_| Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
1422 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(renamed.textrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]text().(), text);
1423 }
1424
1425 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1426 fn test_filter_overrides_with_inforust-analyzer cargo lintian-overrides 0.1.6 tests/test_filter_overrides_with_info().() {
1427 let text = "pkg source: tag1\npkg source: tag2 info\npkg source: tag3\n";
1428 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1429 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1430
1431 // Filter out tag2
1432 let filtered = filter_overridesrust-analyzer cargo lintian-overrides 0.1.6 filter_overrides().(&overrides, |line| {
1433 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(tag) = line.tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().() {
1434 tag.textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]ne()."tag2"
1435 } else {
1436 true
1437 }
1438 });
1439
1440 let result = filtered.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().();
1441 let expected = "pkg source: tag1\npkg source: tag3\n";
1442
1443 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1444 result, expected,
1445 "Newlines should be preserved with package specs and info"
1446 );
1447 }
1448
1449 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1450 fn test_parse_round_trip_without_trailing_newlinerust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_round_trip_without_trailing_newline().() {
1451 // Regression: the parser used to append a NEWLINE token for every
1452 // line including non-newline-terminated trailers, so the round-trip
1453 // gained an extra '\n'.
1454 for input in [
1455 "",
1456 "\x0b",
1457 "tag info",
1458 "tag info\n",
1459 "tag info\ntag2 info\n",
1460 "tag info\ntag2 info",
1461 // Tag alone, with trailing whitespace that must round-trip.
1462 " \x12 ",
1463 "tag ",
1464 "tag\t\t",
1465 // Package-spec text with unusual interior whitespace that the
1466 // previous hard-coded " " between words used to mangle.
1467 "0]\x0b:",
1468 "foo\tsource:",
1469 "binary foo:",
1470 ] {
1471 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(input).treerust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]tree().();
1472 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parsed.textrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]text().(), input, "round-trip differs for {:?}", input);
1473 }
1474 }
1475
1476 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1477 fn test_parse_arch_listrust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_arch_list().() {
1478 let text = "foo [amd64]: some-tag\n";
1479 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1480 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parsed.errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
1481
1482 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1483 let lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1484
1485 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1);
1486 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().(), "some-tag");
1487 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1488 lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().package_namerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_name().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
1489 "foo"
1490 );
1491 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().arch_listrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]arch_list().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["amd64"]);
1492 }
1493
1494 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1495 fn test_parse_arch_list_multiplerust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_arch_list_multiple().() {
1496 let text = "foo [amd64 arm64]: some-tag\n";
1497 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1498 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parsed.errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
1499
1500 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1501 let lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1502
1503 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1);
1504 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1505 lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().arch_listrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]arch_list().(),
1506 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["amd64", "arm64"]
1507 );
1508 }
1509
1510 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1511 fn test_parse_arch_list_negationrust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_arch_list_negation().() {
1512 let text = "foo [!amd64]: some-tag\n";
1513 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1514 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parsed.errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
1515
1516 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1517 let lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1518
1519 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1);
1520 // The '!' is part of the ARCH token text.
1521 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().arch_listrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]arch_list().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["!amd64"]);
1522 }
1523
1524 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1525 fn test_parse_arch_list_with_typerust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_arch_list_with_type().() {
1526 let text = "foo [amd64] binary: some-tag\n";
1527 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1528 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parsed.errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
1529
1530 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1531 let lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1532
1533 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1);
1534 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1535 lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().package_namerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_name().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
1536 "foo"
1537 );
1538 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().arch_listrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]arch_list().(), vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["amd64"]);
1539 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1540 lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().package_typerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_type().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(),
1541 "binary"
1542 );
1543 }
1544
1545 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1546 fn test_parse_arch_list_onlyrust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_arch_list_only().() {
1547 // No package name, just arch list.
1548 let text = "[linux-any]: some-tag\n";
1549 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1550 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parsed.errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
1551
1552 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1553 let lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1554
1555 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1);
1556 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().(), "some-tag");
1557 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1558 lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().arch_listrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]arch_list().(),
1559 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!!["linux-any"]
1560 );
1561 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().package_namerust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]package_name().(), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
1562 }
1563
1564 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1565 fn test_parse_arch_list_no_archrust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_arch_list_no_arch().() {
1566 // A line without an arch list returns an empty vec.
1567 let text = "foo: some-tag\n";
1568 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1569 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(parsed.errorsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors().().is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().());
1570
1571 let overrides = parsed.okrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]ok().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1572 let lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = overrides.linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1573
1574 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1575 lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..package_specrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package_spec().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().arch_listrust-analyzer cargo lintian-overrides 0.1.6 impl#[PackageSpec]arch_list().(),
1576 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![] as Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>
1577 );
1578 }
1579
1580 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1581 fn test_parse_arch_list_roundtriprust-analyzer cargo lintian-overrides 0.1.6 tests/test_parse_arch_list_roundtrip().() {
1582 // Arch list must survive a round-trip unchanged.
1583 for input in [
1584 "foo [amd64]: some-tag\n",
1585 "foo [amd64 arm64]: some-tag\n",
1586 "foo [!amd64]: some-tag\n",
1587 "foo [amd64] binary: some-tag\n",
1588 "[linux-any]: some-tag\n",
1589 ] {
1590 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(input).treerust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]tree().();
1591 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parsed.textrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]text().(), input, "round-trip differs for {:?}", input);
1592 }
1593 }
1594
1595 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1596 fn test_package_name_at_offset_on_namerust-analyzer cargo lintian-overrides 0.1.6 tests/test_package_name_at_offset_on_name().() {
1597 let text = "libcurl4: hardening-no-pie\n";
1598 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1599 let overrides = parsed.treerust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]tree().();
1600 let offset = rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#::fromrust-analyzer cargo text-size 1.1.1 size/impl#[TextSize][`From<u32>`]from().(3u32);
1601 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1602 overrides.package_name_at_offsetrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]package_name_at_offset().(offset),
1603 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("libcurl4".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())
1604 );
1605 }
1606
1607 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1608 fn test_package_name_at_offset_on_tag_returns_nonerust-analyzer cargo lintian-overrides 0.1.6 tests/test_package_name_at_offset_on_tag_returns_none().() {
1609 let text = "libcurl4: hardening-no-pie\n";
1610 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1611 let overrides = parsed.treerust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]tree().();
1612 let offset = rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#::fromrust-analyzer cargo text-size 1.1.1 size/impl#[TextSize][`From<u32>`]from().(14u32);
1613 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overrides.package_name_at_offsetrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]package_name_at_offset().(offset), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
1614 }
1615
1616 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1617 fn test_package_name_at_offset_type_keyword_returns_nonerust-analyzer cargo lintian-overrides 0.1.6 tests/test_package_name_at_offset_type_keyword_returns_none().() {
1618 let text = "source: hardening-no-pie\n";
1619 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1620 let overrides = parsed.treerust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]tree().();
1621 let offset = rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#::fromrust-analyzer cargo text-size 1.1.1 size/impl#[TextSize][`From<u32>`]from().(3u32);
1622 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(overrides.package_name_at_offsetrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]package_name_at_offset().(offset), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
1623 }
1624
1625 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1626 fn test_spec_without_tag_is_errorrust-analyzer cargo lintian-overrides 0.1.6 tests/test_spec_without_tag_is_error().() {
1627 let text = "libcurl4:\n";
1628 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1629 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1630 parsed.errors_with_offsetsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors_with_offsets().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
1631 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![("missing lintian tag", rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#::fromrust-analyzer cargo text-size 1.1.1 size/impl#[TextSize][`From<u32>`]from().(0))]
1632 );
1633 // The tree is still produced and round-trips exactly.
1634 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parsed.treerust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]tree().().textrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]text().(), text);
1635 }
1636
1637 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1638 fn test_unterminated_arch_list_is_errorrust-analyzer cargo lintian-overrides 0.1.6 tests/test_unterminated_arch_list_is_error().() {
1639 let text = "foo [amd64: tag\n";
1640 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1641 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1642 parsed.errors_with_offsetsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors_with_offsets().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
1643 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![("unterminated architecture list", rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#::fromrust-analyzer cargo text-size 1.1.1 size/impl#[TextSize][`From<u32>`]from().(0))]
1644 );
1645 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parsed.treerust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]tree().().textrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]text().(), text);
1646 }
1647
1648 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1649 fn test_partial_parse_reports_offset_of_bad_linerust-analyzer cargo lintian-overrides 0.1.6 tests/test_partial_parse_reports_offset_of_bad_line().() {
1650 // The first and third lines are well-formed; only the second is an
1651 // error, reported at its byte offset, and the tree round-trips whole.
1652 let text = "good: tag\nlibcurl4:\nalso-good: tag2\n";
1653 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1654 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(
1655 parsed.errors_with_offsetsrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]errors_with_offsets().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
1656 vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![("missing lintian tag", rowanrust-analyzer cargo rowan 0.16.1 crate/::TextSizerust-analyzer cargo text-size 1.1.1 size/TextSize#::fromrust-analyzer cargo text-size 1.1.1 size/impl#[TextSize][`From<u32>`]from().(10))]
1657 );
1658 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(parsed.treerust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]tree().().textrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]text().(), text);
1659
1660 let lines: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = parsed.treerust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]tree().().linesrust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]lines().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
1661 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 3);
1662 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..packagerust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "good");
1663 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().(), "tag");
1664 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..packagerust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]package().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), "also-good");
1665 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().(), "tag2");
1666 }
1667
1668 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1669 fn test_error_line_wrapped_in_error_noderust-analyzer cargo lintian-overrides 0.1.6 tests/test_error_line_wrapped_in_error_node().() {
1670 let text = "libcurl4:\n";
1671 let parsed = LintianOverridesrust-analyzer cargo lintian-overrides 0.1.6 LintianOverrides#::parserust-analyzer cargo lintian-overrides 0.1.6 impl#[LintianOverrides]parse().(text);
1672 let has_error_node = parsed
1673 .syntaxrust-analyzer cargo lintian-overrides 0.1.6 impl#[`Parse<T>`]syntax().()
1674 .descendantsrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]descendants().()
1675 .anyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#any().(|n| n.kindrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxNode<L>`]kind().() rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().==rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq(). rust-analyzer cargo lintian-overrides 0.1.6 impl#[SyntaxKind][`PartialEq<Self>`]eq().SyntaxKindrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#::ERRORrust-analyzer cargo lintian-overrides 0.1.6 SyntaxKind#ERROR#);
1676 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(has_error_node);
1677 }
1678 fn unique_temp_dirrust-analyzer cargo lintian-overrides 0.1.6 tests/unique_temp_dir().(label: &str) -> stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf# {
1679 let dir = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::envrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/::temp_dirrust-analyzer cargo std https://github.com/rust-lang/rust/library/std env/temp_dir().().joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(
1680 "lintian-overrides-test-{}-{}",
1681 label,
1682 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::processrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/::idrust-analyzer cargo std https://github.com/rust-lang/rust/library/std process/id().()
1683 ));
1684 let _ = stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::remove_dir_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/remove_dir_all().(&dir);
1685 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::create_dir_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/create_dir_all().(&dir).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1686 dir
1687 }
1688
1689 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1690 fn test_try_iter_overrides_missing_debian_dirrust-analyzer cargo lintian-overrides 0.1.6 tests/test_try_iter_overrides_missing_debian_dir().() {
1691 // No debian directory at all is not an error: there are simply no
1692 // overrides.
1693 let base = unique_temp_dirrust-analyzer cargo lintian-overrides 0.1.6 tests/unique_temp_dir().("missing");
1694 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(try_iter_overridesrust-analyzer cargo lintian-overrides 0.1.6 try_iter_overrides().(&base).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().().lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 0);
1695 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::remove_dir_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/remove_dir_all().(&base).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1696 }
1697
1698 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1699 fn test_try_iter_overrides_reads_source_overridesrust-analyzer cargo lintian-overrides 0.1.6 tests/test_try_iter_overrides_reads_source_overrides().() {
1700 let base = unique_temp_dirrust-analyzer cargo lintian-overrides 0.1.6 tests/unique_temp_dir().("reads");
1701 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::create_dir_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/create_dir_all().(base.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("debian/source")).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1702 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/write().(
1703 base.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("debian/source/lintian-overrides"),
1704 "foo source: some-tag\n",
1705 )
1706 .unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1707
1708 let lines = try_iter_overridesrust-analyzer cargo lintian-overrides 0.1.6 try_iter_overrides().(&base).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1709 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().(), 1);
1710 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(lines[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()..tagrust-analyzer cargo lintian-overrides 0.1.6 impl#[OverrideLine]tag().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().textrust-analyzer cargo rowan 0.16.1 api/impl#[`SyntaxToken<L>`]text().(), "some-tag");
1711 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::remove_dir_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/remove_dir_all().(&base).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1712 }
1713
1714 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
1715 fn test_try_iter_overrides_propagates_read_dir_errorrust-analyzer cargo lintian-overrides 0.1.6 tests/test_try_iter_overrides_propagates_read_dir_error().() {
1716 // A debian "directory" that is actually a file must surface the I/O
1717 // error rather than being silently treated as having no overrides:
1718 // callers rely on overrides to suppress fixes.
1719 let base = unique_temp_dirrust-analyzer cargo lintian-overrides 0.1.6 tests/unique_temp_dir().("notadir");
1720 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/write().(base.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("debian"), "not a directory").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1721
1722 let err = try_iter_overridesrust-analyzer cargo lintian-overrides 0.1.6 try_iter_overrides().(&base).unwrap_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap_err().();
1723 assert_nerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_ne!!(err.kindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/impl#[Error]kind().(), stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::ErrorKindrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#::NotFoundrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/ErrorKind#NotFound#);
1724 stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/::remove_dir_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std fs/remove_dir_all().(&base).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().();
1725 }
1726 }