Skip to content

Commit 6f51696

Browse files
committed
templater: use property.map() to apply infallible transformation
Also renamed data to line as the type name was changed to AnnotationLine.
1 parent e220fe3 commit 6f51696

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cli/src/commit_templater.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,23 +2234,23 @@ pub fn builtin_annotation_line_methods<'repo>(
22342234
"commit",
22352235
|_language, _diagnostics, _build_ctx, self_property, function| {
22362236
function.expect_no_arguments()?;
2237-
let out_property = self_property.and_then(|data| Ok(data.commit));
2237+
let out_property = self_property.map(|line| line.commit);
22382238
Ok(L::wrap_commit(out_property))
22392239
},
22402240
);
22412241
map.insert(
22422242
"line_number",
22432243
|_language, _diagnostics, _build_ctx, self_property, function| {
22442244
function.expect_no_arguments()?;
2245-
let out_property = self_property.and_then(|data| Ok(data.line_number.try_into()?));
2245+
let out_property = self_property.and_then(|line| Ok(line.line_number.try_into()?));
22462246
Ok(L::wrap_integer(out_property))
22472247
},
22482248
);
22492249
map.insert(
22502250
"first_line_in_hunk",
22512251
|_language, _diagnostics, _build_ctx, self_property, function| {
22522252
function.expect_no_arguments()?;
2253-
let out_property = self_property.and_then(|data| Ok(data.first_line_in_hunk));
2253+
let out_property = self_property.map(|line| line.first_line_in_hunk);
22542254
Ok(L::wrap_boolean(out_property))
22552255
},
22562256
);

0 commit comments

Comments
 (0)