(
w: &mut dyn Write,
func: &Function,
entity: AnyEntity,
value: &dyn fmt::Display,
func_w: &mut dyn FuncWriter,
errors: &mut Vec<VerifierError>,
)
| 152 | } |
| 153 | |
| 154 | fn pretty_preamble_error( |
| 155 | w: &mut dyn Write, |
| 156 | func: &Function, |
| 157 | entity: AnyEntity, |
| 158 | value: &dyn fmt::Display, |
| 159 | func_w: &mut dyn FuncWriter, |
| 160 | errors: &mut Vec<VerifierError>, |
| 161 | ) -> fmt::Result { |
| 162 | let mut s = String::new(); |
| 163 | func_w.write_entity_definition(&mut s, func, entity, value)?; |
| 164 | write!(w, "{s}")?; |
| 165 | |
| 166 | // TODO: Use drain_filter here when it gets stabilized |
| 167 | let mut i = 0; |
| 168 | let mut printed_error = false; |
| 169 | while i != errors.len() { |
| 170 | if entity == errors[i].location { |
| 171 | if !printed_error { |
| 172 | print_arrow(w, &s)?; |
| 173 | printed_error = true; |
| 174 | } |
| 175 | let err = errors.remove(i); |
| 176 | print_error(w, err)?; |
| 177 | } else { |
| 178 | i += 1 |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | if printed_error { |
| 183 | w.write_char('\n')?; |
| 184 | } |
| 185 | |
| 186 | Ok(()) |
| 187 | } |
| 188 | |
| 189 | /// Prints: |
| 190 | /// ; ^~~~~~ |
no test coverage detected