Debian Codegraph @

src/tagfile.rs

raw symbols SCIP
1 //! Contains structs and functions to parse Debian-styled RFC 822 files.
2 use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#;
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#;
4 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/;
5
6 #[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:)]
7 /// The result of a parsing error.
8 pub struct ParserErrorrust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError# {
9 pub msgrust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError#msg.: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#,
10 pub linerust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError#line.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>,
11 }
12
13 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 ParserErrorrust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError# {
14 fn fmtrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[ParserError][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# {
15 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(num) = self.linerust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError#line. {
16 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{} at line '{num}'", self.msgrust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError#msg.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
17 } else {
18 writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{}", self.msgrust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError#msg.)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().
19 }
20 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
21 }
22 }
23
24 impl stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std error/::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core error/Error# for ParserErrorrust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError# {}
25
26 /// A section in a TagFile. A TagFile is made up of double-newline (`\n\n`)
27 /// separated paragraphs, each of which make up one of these sections.
28 #[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:)]
29 pub struct TagSectionrust-analyzer cargo rust-apt 0.8.0 tagfile/TagSection# {
30 datarust-analyzer cargo rust-apt 0.8.0 tagfile/TagSection#data.: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<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#>,
31 }
32
33 impl TagSectionrust-analyzer cargo rust-apt 0.8.0 tagfile/TagSection# {
34 fn errorrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]error().(msg: &str, line: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection], ParserErrorrust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError#> {
35 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ParserErrorrust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError# {
36 msgrust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError#msg.: "E:".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().() rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().+rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Add<&str>`]add().msg,
37 linerust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError#line.,
38 })
39 }
40
41 fn line_is_keyrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]line_is_key().(line: &str) -> bool { !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().(' ') && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('\t') }
42
43 fn next_line_extends_valuerust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]next_line_extends_value().(lines: &[&str], current_line: usize) -> bool {
44 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(next_line) = lines.getrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]get().(current_line 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) {
45 !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().Selfrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]::line_is_keyrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]line_is_key().(next_line)
46 } else {
47 false
48 }
49 }
50
51 /// Create a new [`TagSection`] instance.
52 /// # Returns
53 /// * A [`Result`]: The [`Ok`] variant if there was no issue parsing the
54 /// section, and the [`Err`] variant if there was.
55 pub fn newrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]new().(section: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection], ParserErrorrust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError#> {
56 // Make sure the string doesn't contain multiple sections.
57 if section.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().("\n\n") {
58 return Selfrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]::errorrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]error().("More than one section was found", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
59 }
60
61 // Make sure the user didn't pass an empty string.
62 if section.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
63 return Selfrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]::errorrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]error().("An empty string was passed", Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#);
64 }
65
66 // Start building up the HashMap.
67 let mut data = HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V>`]new().();
68 let lines = section.linesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]lines().().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#<&str>>();
69
70 // Variables used while parsing.
71 let mut current_key: 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#> = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
72 let mut current_value = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().();
73
74 for (index, line) in lines.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() {
75 // Indexes start at 0, so increase by 1 to get the line number.
76 let line_number = index 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;
77
78 // If this line starts with a comment ignore it.
79 if line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('#') {
80 continue;
81 }
82
83 // If this line is a new key, split the line into the key and its value.
84 if Selfrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]::line_is_keyrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]line_is_key().(line) {
85 let (key, value) = match line.split_oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split_once().(':') {
86 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((key, value)) => {
87 (key.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), value.strip_prefixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]strip_prefix().(' ').unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().(value))
88 },
89 Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => {
90 return Selfrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]::errorrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]error().(
91 "Line doesn't contain a ':' separator",
92 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(line_number),
93 );
94 },
95 };
96
97 // Set the current key and value.
98 // If the value is empty, then this is a multiline field, and it's going to be
99 // one of these things:
100 // 1. A multiline field, in which case we want to add a
101 // newline to reflect such.
102 // 2. A key with an empty value, in which case it will
103 // be removed post-processing.
104 current_key = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(key);
105
106 if value.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() {
107 current_value = "\n".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().();
108 } else {
109 current_value = value.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().();
110
111 // If the next extends the value, add the newline before it.
112 if Selfrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]::next_line_extends_valuerust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]next_line_extends_value().(&lines, index) {
113 current_value rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign().+=rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign()."\n";
114 }
115 }
116 }
117
118 // If this line is indented with spaces or tabs, add it to the current value.
119 // This should never end up running in conjunction with the above `if` block.
120 if line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().(' ') || line.starts_withrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]starts_with().('\t') {
121 current_value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/AddAssign#add_assign().line;
122
123 // If the next line extends the value, add the newline. `line_number`
124 // conveniently is the next index, so use that to our advantage.
125 if Selfrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]::next_line_extends_valuerust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]next_line_extends_value().(&lines, index) {
126 current_value rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign().+=rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`AddAssign<&str>`]add_assign()."\n";
127 }
128 }
129
130 // If the next line is a new key or this is the last line, add the current key
131 // and value to the HashMap. `line_number` conveniently is the next index, so
132 // use that to our advantage.
133 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().Selfrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]::next_line_extends_valuerust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]next_line_extends_value().(&lines, index) {
134 // If no key exists, we've defined a paragraph (at the beginning of the control
135 // file) with no key. This would be parsed at the very beginning, but the file
136 // may have an unknown amount of comment lines, so we just do this here as a
137 // normal step of the parsing stage.
138 if current_key.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() {
139 return Selfrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]::errorrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]error().(
140 "No key defined for the currently indented line",
141 Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(line_number),
142 );
143 }
144
145 // Add the key and reset the `current_key` and `current_value` counters.
146 data.insertrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]insert().(current_key.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), current_value);
147 current_key = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#;
148 current_value = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().();
149 }
150 }
151
152 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection] { datarust-analyzer cargo rust-apt 0.8.0 tagfile/TagSection#data. })
153 }
154
155 /// Get the underlying [`HashMap`] used in the generated [`TagSection`].
156 pub fn hashmaprust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]hashmap().(&self) -> &HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<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#> { &self.datarust-analyzer cargo rust-apt 0.8.0 tagfile/TagSection#data. }
157
158 /// Get the value of the specified key.
159 pub fn getrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]get().(&self, key: &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#> { self.datarust-analyzer cargo rust-apt 0.8.0 tagfile/TagSection#data..getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(key) }
160
161 /// Get the value of the specified key,
162 ///
163 /// Returns specified default on failure.
164 pub fn get_defaultrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]get_default().<'a, 'b: 'a>(&'a self, key: &str, default: &'b str) -> &str {
165 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(value) = self.datarust-analyzer cargo rust-apt 0.8.0 tagfile/TagSection#data..getrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/impl#[`HashMap<K, V, S, A>`]get().(key) {
166 return value;
167 }
168 default
169 }
170 }
171
172 /// Parses a TagFile: these are files such as Debian `control` and `Packages`
173 /// files.
174 ///
175 /// # Returns
176 /// * A [`Result`]: The [`Ok`] variant containing the vector of [`TagSection`]
177 /// objects if there was no issue parsing the file, and the [`Err`] variant if
178 /// there was.
179 pub fn parse_tagfilerust-analyzer cargo rust-apt 0.8.0 tagfile/parse_tagfile().(content: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<TagSectionrust-analyzer cargo rust-apt 0.8.0 tagfile/TagSection#>, ParserErrorrust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError#> {
180 let mut sections = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![];
181 let section_strings = content.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().("\n\n");
182
183 for (iter, section) in section_strings.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Split<'a, P>`][Clone]clone().().enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().() {
184 // If this section is empty (i.e. more than one empty line was placed between
185 // each section), then ignore this section.
186 if section.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]is_empty().() || section.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(|c| 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().'\n') {
187 break;
188 }
189
190 match TagSectionrust-analyzer cargo rust-apt 0.8.0 tagfile/TagSection#::newrust-analyzer cargo rust-apt 0.8.0 tagfile/impl#[TagSection]new().(section) {
191 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(section) => sections.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(section),
192 Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(mut err) => {
193 // If an error line was provided, add the number of lines in the sections before
194 // this one. Otherwise no line was specified, and we'll just specify the number
195 // of lines in the section before this one so we know which section the line is
196 // in.
197 let mut line_count = 0;
198
199 for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#iter {
200 // Add one for the line separation between each section.
201 line_count 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().1;
202
203 // Add the line count in this section.
204 line_count 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().section_strings.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Split<'a, P>`][Clone]clone().().countrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#count().();
205 }
206
207 if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(line) = err.linerust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError#line. {
208 err.linerust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError#line. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(line_count 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().line);
209 } else {
210 err.linerust-analyzer cargo rust-apt 0.8.0 tagfile/ParserError#line. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(line_count);
211 }
212 },
213 }
214 }
215
216 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(sections)
217 }