Add the given span to this sequence, putting it in the right place.
(&mut self, span: ast::Span)
| 194 | |
| 195 | /// Add the given span to this sequence, putting it in the right place. |
| 196 | fn add(&mut self, span: ast::Span) { |
| 197 | // This is grossly inefficient since we sort after each add, but right |
| 198 | // now, we only ever add two spans at most. |
| 199 | if span.is_one_line() { |
| 200 | let i = span.start.line - 1; // because lines are 1-indexed |
| 201 | self.by_line[i].push(span); |
| 202 | self.by_line[i].sort(); |
| 203 | } else { |
| 204 | self.multi_line.push(span); |
| 205 | self.multi_line.sort(); |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | /// Notate the pattern string with carents (`^`) pointing at each span |
| 210 | /// location. This only applies to spans that occur within a single line. |
no test coverage detected