diff --git a/src/dijkstra.rs b/src/dijkstra.rs index 85bd7762f..52e96b37c 100644 --- a/src/dijkstra.rs +++ b/src/dijkstra.rs @@ -1,3 +1,6 @@ +//! Implements Dijkstra's algorithm for shortest path, to find an +//! optimal and readable diff between two ASTs. + use std::cmp::{min, Ordering, Reverse}; use std::collections::BinaryHeap; use std::hash::{Hash, Hasher}; diff --git a/src/intervals.rs b/src/intervals.rs index ebae92e34..98fb32423 100644 --- a/src/intervals.rs +++ b/src/intervals.rs @@ -1,3 +1,5 @@ +//! A range between ordered values. + /// An interval that is inclusive of `from` but exclusive of `to`. /// /// This is a an alternative to `Range`, which has some API warts: diff --git a/src/lines.rs b/src/lines.rs index 18abfb9be..33aa1da73 100644 --- a/src/lines.rs +++ b/src/lines.rs @@ -1,3 +1,5 @@ +//! Manipulate lines of text and groups of lines. + use crate::intervals::Interval; use crate::positions::SingleLineSpan; use crate::syntax::{aligned_lines, MatchKind, MatchedPos}; diff --git a/src/parse.rs b/src/parse.rs index 55716d2a9..4ffe57cd3 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -1,3 +1,5 @@ +//! Lexes source code and parses delimiters according to `syntax.toml`. + use crate::lines::NewlinePositions; use crate::positions::SingleLineSpan; use crate::syntax::Syntax; diff --git a/src/positions.rs b/src/positions.rs index 7eead796e..3506b2fb7 100644 --- a/src/positions.rs +++ b/src/positions.rs @@ -1,3 +1,5 @@ +//! Represents positions within a string. + use crate::lines::LineNumber; /// A range within a single line of a string. diff --git a/src/style.rs b/src/style.rs index 96cafd61a..3367e629f 100644 --- a/src/style.rs +++ b/src/style.rs @@ -1,3 +1,5 @@ +//! Apply colours and styling to strings. + use crate::lines::LineNumber; use crate::positions::SingleLineSpan; use crate::syntax::{MatchKind, MatchedPos}; diff --git a/src/syntax.rs b/src/syntax.rs index d1f8e0b9a..11bb3ee1a 100644 --- a/src/syntax.rs +++ b/src/syntax.rs @@ -1,3 +1,5 @@ +//! Syntax tree definitions with change metadata. + #![allow(clippy::mutable_key_type)] // Hash for Syntax doesn't use mutable fields. use itertools::{EitherOrBoth, Itertools};