![](/static/253f0d9b/assets/icons/icon-96x96.png)
![](https://programming.dev/pictrs/image/1f7e5534-88d3-4d6f-bc57-7cda9553890f.webp)
You might be okay with this:
macro_rules! span {
($line:expr, $column:expr) => {
Span {
line: $line,
column: $column,
file_path: None,
}
};
($line:expr, $column:expr, $file_path:literal) => {
Span {
line: $line,
column: $column,
file_path: Some($file_path.to_string()),
}
};
($line:expr, $column:expr, $file_path:expr) => {
Span {
line: $line,
column: $column,
file_path: $file_path,
}
};
}
However, sometimes I don’t want to pass in the file path directly but through a variable that is Option<String>.
Essentially I took this to mean str
literals will be auto wrapped in Some
, but anything else is expected to be Option<String>
I noticed it and placed a few pixels :D
Here’s one on the claw