Skip to content

Commit 024b237

Browse files
committed
common
1 parent 49db3d4 commit 024b237

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

crates/artifacts/solc/src/error.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ use serde::{Deserialize, Serialize};
33
use std::{fmt, ops::Range, str::FromStr};
44
use yansi::{Color, Style};
55

6+
const ARROW: &str = "-->";
7+
68
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
79
pub struct SourceLocation {
810
pub file: String,
@@ -158,7 +160,7 @@ impl fmt::Display for Error {
158160
// location.
159161
lines.next();
160162
while let Some(line) = lines.clone().next() {
161-
if line.contains("-->") {
163+
if line.contains(ARROW) {
162164
break;
163165
}
164166
lines.next();
@@ -268,11 +270,9 @@ fn fmt_source_location(f: &mut fmt::Formatter<'_>, lines: &mut std::str::Lines<'
268270
// --> source
269271
if let Some(line) = lines.next() {
270272
f.write_str("\n")?;
271-
272-
let arrow = "-->";
273-
if let Some((left, loc)) = line.split_once(arrow) {
273+
if let Some((left, loc)) = line.split_once(ARROW) {
274274
f.write_str(left)?;
275-
styled(f, Error::frame_style(), |f| f.write_str(arrow))?;
275+
styled(f, Error::frame_style(), |f| f.write_str(ARROW))?;
276276
f.write_str(loc)?;
277277
} else {
278278
f.write_str(line)?;

0 commit comments

Comments
 (0)