Skip to content

Commit c104123

Browse files
Hawk777Byron
authored andcommitted
Fix typos in comments
1 parent 54b4216 commit c104123

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/lib.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
//! To compute an input sequence is required. `imara-diff` computes diffs on abstract
2929
//! sequences represented as a slice of ids/tokens: [`Token`](crate::Token). To create
3030
//! such a sequence from your input type (for example text) the input needs to be interned.
31-
//! For that `imara-diff` provides utilites in the form of `InternedInput` struct and
31+
//! For that `imara-diff` provides utilities in the form of `InternedInput` struct and
3232
//! `TokenSource` trait to construct it. The [`InternedInput`] contains the two sides of
3333
//! the diff (used while computing the diff). As well as the interner that allows mapping
34-
//! back tokens to ther original data.
34+
//! back tokens to their original data.
3535
//!
3636
//! The most common usecase for diff is comparing text. `&str` implements `TokenSource`
37-
//! by default segmentent the text into lines. So creating an input for a text-based diff
38-
//! usually looks something like the following:
37+
//! by default segment the text into lines. So creating an input for a text-based diff usually
38+
//! looks something like the following:
3939
//!
4040
//! ```
4141
//! # use imara_diff::InternedInput;
@@ -54,7 +54,7 @@
5454
//! ## Computing the Diff
5555
//!
5656
//! A diff of two sequences is represented by the [`Diff`] struct and computed by
57-
//! [`Diff::compute`] / [`Diff::compute_with`]. Here also an algorithm can be choosen.
57+
//! [`Diff::compute`] / [`Diff::compute_with`]. Here also an algorithm can be chosen.
5858
//! In most situations [`Algorithm::Histogram`] is a good choice, refer to the docs
5959
//! of [`Algorithm`] for more details. After the initial computation the diff can be
6060
//! postprocessed. If the diff is shown to a human you in some way (even indirectly) you
@@ -78,16 +78,16 @@
7878
//!
7979
//! ## Accessing results
8080
//!
81-
//! [`Diff`] allows to query wether a particular position was removed/added on either
81+
//! [`Diff`] allows to query whether a particular position was removed/added on either
8282
//! side of the diff with [`Diff::is_removed`] / [`Diff::is_added`]. The number
83-
//! of addtions/removeals can be quickly counted with [`Diff::count_removals`] /
83+
//! of additions/removals can be quickly counted with [`Diff::count_removals`] /
8484
//! [`Diff::count_additions`]. The most powerful/useful interface is the hunk iterator
8585
//! [`Diff::hunks`] which will return a list of additions/removals/modifications in the
8686
//! order that they appear in the input.
8787
//!
88-
//! Finnally if the `unified_diff` feature is enabled a diff can be printed with
88+
//! Finally if the `unified_diff` feature is enabled a diff can be printed with
8989
//! [`Diff::unified_diff`] to print a unified diff/patch as shown by `git diff` or `diff
90-
//! -u`. Note that while the unified diff has a decent amount of flexability it is fairly
90+
//! -u`. Note that while the unified diff has a decent amount of flexibility it is fairly
9191
//! simplistic and not every formatting may be possible. It's meant to cover common
9292
//! situations but not cover every advanced usecase. Instead if you need more advanced
9393
//! printing built your own printer on top of the `Diff::hunks` iterator, for that you can
@@ -189,7 +189,7 @@ pub enum Algorithm {
189189
/// produced by the histogram diff are often longer then those produced by Myers algorithm.
190190
///
191191
/// The heuristic used by the histogram diff does not work well for inputs with small (often repeated)
192-
/// tokens. For example **character diffs do not work well** as most (english) text is madeup of
192+
/// tokens. For example **character diffs do not work well** as most (english) text is made up of
193193
/// a fairly small set of characters. The `Histogram` algorithm will automatically these cases and
194194
/// fallback to Myers algorithm. However this detection has a nontrivial overhead, so
195195
/// if its known upfront that the sort of tokens is very small `Myers` algorithm should
@@ -305,10 +305,10 @@ impl Diff {
305305
}
306306

307307
/// Postprocesses the diff to make it more human readable. Certain bvhunks
308-
/// have an amigous placement (event in a minimal diff) where they can move
308+
/// have an ambiguous placement (even in a minimal diff) where they can move
309309
/// downward or upward by removing a token (line) at the start and adding
310310
/// one at the end (or the other way around). The postprocessing adjust
311-
/// these hunks according to a coulple rules:
311+
/// these hunks according to a couple rules:
312312
///
313313
/// * Always merge multiple hunks if possible.
314314
/// * Always try to create a single MODIFY hunk instead of multiple disjoint
@@ -319,16 +319,16 @@ impl Diff {
319319
}
320320

321321
/// Postprocesses the diff to make it more human readable. Certain bvhunks
322-
/// have an amigous placement (event in a minimal diff) where they can move
322+
/// have an ambiguous placement (even in a minimal diff) where they can move
323323
/// downward or upward by removing a token (line) at the start and adding
324324
/// one at the end (or the other way around). The postprocessing adjust
325-
/// these hunks according to a coulple rules:
325+
/// these hunks according to a couple rules:
326326
///
327327
/// * Always merge multiple hunks if possible.
328328
/// * Always try to create a single MODIFY hunk instead of multiple disjoint
329329
/// ADDED/REMOVED hunks
330330
/// * based on a lines indentation level heuristically compute the most
331-
/// intutive location to split lines.
331+
/// intuitive location to split lines.
332332
/// * Move sliders as far down as possible.
333333
pub fn postprocess_lines<T: AsRef<[u8]>>(&mut self, input: &InternedInput<T>) {
334334
self.postprocess_with_heuristic(
@@ -351,7 +351,7 @@ impl Diff {
351351
}
352352

353353
/// A single change in a `Diff` that represents a range of tokens (`before`)
354-
/// in the first sequence that were replaced by a diffrerent range of tokens
354+
/// in the first sequence that were replaced by a different range of tokens
355355
/// in the second sequence (`after`).
356356
///
357357
/// Tokens that are a
@@ -364,8 +364,8 @@ pub struct Hunk {
364364
impl Hunk {
365365
/// Can be used instead of `Option::None` for better performance.
366366
/// Because `imara-diff` does not support more then `i32::MAX` there is an unused bit pattern that can be used.
367-
/// Has some nice properties where it usually is not necessary to check for `None` seperatly:
368-
/// Empty ranges fail contains checks and also faills smaller then checks.
367+
/// Has some nice properties where it usually is not necessary to check for `None` separately:
368+
/// Empty ranges fail contains checks and also fail smaller then checks.
369369
pub const NONE: Hunk = Hunk {
370370
before: u32::MAX..u32::MAX,
371371
after: u32::MAX..u32::MAX,
@@ -391,9 +391,9 @@ impl Hunk {
391391
}
392392
}
393393

394-
/// Yields all [`Hunk`]s in a file in montonically increasing order.
395-
/// Montonically increasing means here that the following holds for any two
396-
/// consequtive [`Hunk`]s `x` and `y`:
394+
/// Yields all [`Hunk`]s in a file in monotonically increasing order.
395+
/// Monotonically increasing means here that the following holds for any two
396+
/// consecutive [`Hunk`]s `x` and `y`:
397397
///
398398
/// ``` no_compile
399399
/// assert!(x.before.end < y.before.start);

0 commit comments

Comments
 (0)