aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 0b64b22..4faaf20 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -41,16 +41,18 @@ impl Todos<'_> {
// );
if let Some(line_number) = line.new_lineno() {
- let l = std::str::from_utf8(line.content()).unwrap();
-
- if l.contains("TODO") {
- write!(
- write_to,
- "{}:{}:{}",
- delta.new_file().path().unwrap().display(),
- line_number,
- l,
- ).unwrap();
+ if let Ok(l) = std::str::from_utf8(line.content()) {
+ if l.contains("TODO") {
+ if let Some(path) = delta.new_file().path() {
+ write!(
+ write_to,
+ "{}:{}:{}",
+ path.display(),
+ line_number,
+ l,
+ ).expect("write error");
+ }
+ }
}
}