Skip to main content

Module fix

Module fix 

Source
Expand description

Applying Edits to the source of a parsed json::Document.

Producing the edits and agreeing to apply them are separate steps, which is what lets edits drawn from different kinds of warning be resolved together. A warning::Set<schema::Warning> and a warning::Set<lint::tariff::Warning> are different types, so no single call can take both; Edit is the common form each reduces to, and a caller concatenates them before one apply.

Applying each set in turn instead would resolve the second against a re-parsed document, where the ids of the first no longer mean the same elements, so two edits landing on one element could not be resolved against each other at all.

apply resolves a whole set of edits against one document in a single pass. Resolving them one at a time would be wrong for the same reason within a set: which span removes an element depends on which of its siblings survive, so removals have to be resolved together. See json::Document::removal_spans.

Structs§

Edit
A single change to one element of a document.

Enums§

Error
Why a set of Edits could not be applied.

Traits§

Fixable
A Warning that a mechanical edit can resolve.

Functions§

apply
Apply edits to the source of doc and return the edited JSON.
edits
The edits that resolve warnings against the document they were raised on.