(existing_code: &str, patch: &CodePatch)
| 72 | } |
| 73 | |
| 74 | pub fn apply_patch(existing_code: &str, patch: &CodePatch) -> Result<String> { |
| 75 | match &patch.representation { |
| 76 | PatchRepresentation::UnifiedDiff(diff) => apply_unified_diff(existing_code, diff), |
| 77 | PatchRepresentation::ASTTransform(ast_edit) => bail!( |
| 78 | "cannot apply abstract AST transform for '{}' without a concrete rewrite", |
| 79 | ast_edit.target_symbol |
| 80 | ), |
| 81 | } |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | fn apply_line_replacement( |
nothing calls this directly
no test coverage detected