Refactor Fix and Edit API (#4198)

This commit is contained in:
Zanie Adkins 2023-05-08 04:57:03 -05:00 committed by GitHub
parent edaf891042
commit 0801f14046
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
102 changed files with 529 additions and 398 deletions

View file

@ -215,14 +215,10 @@ pub fn check(contents: &str, options: JsValue) -> Result<JsValue, JsValue> {
message: message.kind.body,
location: start_location,
end_location,
fix: if message.fix.is_empty() {
None
} else {
Some(ExpandedFix {
message: message.kind.suggestion,
edits: message.fix.into_edits(),
})
},
fix: message.fix.map(|fix| ExpandedFix {
message: message.kind.suggestion,
edits: fix.into_edits(),
}),
}
})
.collect();