From b25f974c0d6277de3f8f8473533f3f263ec9fbb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 19 Oct 2018 00:44:14 +0200 Subject: [PATCH] fix a few typos found via codespell. --- CHANGELOG.md | 2 +- src/comment.rs | 2 +- src/config/config_type.rs | 2 +- src/items.rs | 2 +- src/lib.rs | 4 ++-- src/missed_spans.rs | 2 +- src/patterns.rs | 2 +- src/string.rs | 4 ++-- tests/source/match.rs | 2 +- tests/source/pattern-condense-wildcards.rs | 2 +- tests/source/remove_blank_lines.rs | 2 +- tests/source/reorder-impl-items.rs | 2 +- tests/target/impl.rs | 2 +- tests/target/match.rs | 2 +- tests/target/pattern-condense-wildcards.rs | 2 +- tests/target/remove_blank_lines.rs | 2 +- tests/target/reorder-impl-items.rs | 2 +- 17 files changed, 19 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d868d83a5ce7c..87b54af82994b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -97,7 +97,7 @@ ### Changed -- Warn when unkown configuration option is used. +- Warn when unknown configuration option is used. ### Fixed diff --git a/src/comment.rs b/src/comment.rs index 9dd7d68965598..358c18e1b954d 100644 --- a/src/comment.rs +++ b/src/comment.rs @@ -832,7 +832,7 @@ fn trim_custom_comment_prefix(s: &str) -> String { let left_trimmed = line.trim_left(); if left_trimmed.starts_with(RUSTFMT_CUSTOM_COMMENT_PREFIX) { let orig = left_trimmed.trim_left_matches(RUSTFMT_CUSTOM_COMMENT_PREFIX); - // due to comment wrapping, a line that was originaly behind `#` is split over + // due to comment wrapping, a line that was originally behind `#` is split over // multiple lines, which needs then to be prefixed with a `#` if !orig.trim_left().starts_with("# ") { Cow::from(format!("# {}", orig)) diff --git a/src/config/config_type.rs b/src/config/config_type.rs index 419cd06436ffa..b7c1da3601723 100644 --- a/src/config/config_type.rs +++ b/src/config/config_type.rs @@ -424,7 +424,7 @@ macro_rules! create_config { self.ignore.2.add_prefix(dir); } - /// Returns true if the config key was explicitely set and is the default value. + /// Returns true if the config key was explicitly set and is the default value. pub fn is_default(&self, key: &str) -> bool { $( if let stringify!($i) = key { diff --git a/src/items.rs b/src/items.rs index 19caafbfb828c..ee4cd866ac25d 100644 --- a/src/items.rs +++ b/src/items.rs @@ -1592,7 +1592,7 @@ pub fn rewrite_struct_field( for _ in 0..lhs_offset { spacing.push(' '); } - // In this extreme case we will be missing a space betweeen an attribute and a field. + // In this extreme case we will be missing a space between an attribute and a field. if prefix.is_empty() && !attrs_str.is_empty() && attrs_extendable && spacing.is_empty() { spacing.push(' '); } diff --git a/src/lib.rs b/src/lib.rs index ff006325be0f6..6f366f0b64ada 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -117,7 +117,7 @@ pub enum ErrorKind { /// An io error during reading or writing. #[fail(display = "io error: {}", _0)] IoError(io::Error), - /// Parse error occured when parsing the Input. + /// Parse error occurred when parsing the input. #[fail(display = "parse error")] ParseError, /// The user mandated a version and the current version of Rustfmt does not @@ -407,7 +407,7 @@ fn format_code_block(code_snippet: &str, config: &Config) -> Option { // While formatting the code, ignore the config's newline style setting and always use "\n" // instead of "\r\n" for the newline characters. This is okay because the output here is // not directly outputted by rustfmt command, but used by the comment formatter's input. - // We have output-file-wide "\n" ==> "\r\n" conversion proccess after here if it's necessary. + // We have output-file-wide "\n" ==> "\r\n" conversion process after here if it's necessary. let mut config_with_unix_newline = config.clone(); config_with_unix_newline .set() diff --git a/src/missed_spans.rs b/src/missed_spans.rs index b7d73bbf0ba2f..2b48673dcd4f9 100644 --- a/src/missed_spans.rs +++ b/src/missed_spans.rs @@ -20,7 +20,7 @@ use utils::{count_newlines, last_line_width, mk_sp}; use visitor::FmtVisitor; struct SnippetStatus { - /// An offset to the current line from the beginnig of the original snippet. + /// An offset to the current line from the beginning of the original snippet. line_start: usize, /// A length of trailing whitespaces on the current line. last_wspace: Option, diff --git a/src/patterns.rs b/src/patterns.rs index bd4af3f7bba41..675572f490842 100644 --- a/src/patterns.rs +++ b/src/patterns.rs @@ -29,7 +29,7 @@ use spanned::Spanned; use types::{rewrite_path, PathContext}; use utils::{format_mutability, mk_sp, rewrite_ident}; -/// Returns true if the given pattern is short. A short pattern is defined by the following grammer: +/// Returns true if the given pattern is short. A short pattern is defined by the following grammar: /// /// [small, ntp]: /// - single token diff --git a/src/string.rs b/src/string.rs index bbf51ffcba35e..561d96813b0d1 100644 --- a/src/string.rs +++ b/src/string.rs @@ -62,7 +62,7 @@ impl<'a> StringFormat<'a> { ) } - /// Like max_chars_with_indent but the indentation is not substracted. + /// Like max_chars_with_indent but the indentation is not subtracted. /// This allows to fit more graphemes from the string on a line when /// SnippetState::EndWithLineFeed. fn max_chars_without_indent(&self) -> Option { @@ -236,7 +236,7 @@ fn break_string(max_chars: usize, trim_end: bool, line_end: &str, input: &[&str] .iter() .rposition(|grapheme| not_whitespace_except_line_feed(grapheme)) .unwrap_or(index); - // Take into account newlines occuring in input[0..=index], i.e., the possible next new + // Take into account newlines occurring in input[0..=index], i.e., the possible next new // line. If there is one, then text after it could be rewritten in a way that the available // space is fully used. for (i, grapheme) in input[0..=index].iter().enumerate() { diff --git a/tests/source/match.rs b/tests/source/match.rs index c5a5455cfc7e5..116f5f718b9c4 100644 --- a/tests/source/match.rs +++ b/tests/source/match.rs @@ -150,7 +150,7 @@ fn issue339() { { } - p => { // Dont collapse me + p => { // Don't collapse me } q => { } r => { diff --git a/tests/source/pattern-condense-wildcards.rs b/tests/source/pattern-condense-wildcards.rs index 244e935639af5..69c3fa3cbad8d 100644 --- a/tests/source/pattern-condense-wildcards.rs +++ b/tests/source/pattern-condense-wildcards.rs @@ -7,6 +7,6 @@ fn main() { Tup (_) => "nah", Quad (_,_, x,_) => " also no rewrite", Quad (x, _, _, _) => "condense me pls", - Weird (x, _, _, /* dont condense before */ _, _, _) => "pls work", + Weird (x, _, _, /* don't condense before */ _, _, _) => "pls work", } } diff --git a/tests/source/remove_blank_lines.rs b/tests/source/remove_blank_lines.rs index 7466e21eed845..43733ce7636f3 100644 --- a/tests/source/remove_blank_lines.rs +++ b/tests/source/remove_blank_lines.rs @@ -35,7 +35,7 @@ fn bar() { // comment after statement - // comment before statment + // comment before statement let y = 2; let z = 3; diff --git a/tests/source/reorder-impl-items.rs b/tests/source/reorder-impl-items.rs index ab008b89d22ac..16efff55b0660 100644 --- a/tests/source/reorder-impl-items.rs +++ b/tests/source/reorder-impl-items.rs @@ -1,6 +1,6 @@ // rustfmt-reorder_impl_items: true -// The ordering of the folllowing impl items should be idempotent. +// The ordering of the following impl items should be idempotent. impl<'a> Command<'a> { pub fn send_to(&self, w: &mut io::Write) -> io::Result<()> { match self { diff --git a/tests/target/impl.rs b/tests/target/impl.rs index 5895c74bcc9f1..f37fbcf1fcbcc 100644 --- a/tests/target/impl.rs +++ b/tests/target/impl.rs @@ -8,7 +8,7 @@ impl>> Handle Test where - V: Clone, // This comment is NOT removed by formating! + V: Clone, // This comment is NOT removed by formatting! { pub fn new(value: V) -> Self { Test { diff --git a/tests/target/match.rs b/tests/target/match.rs index c8a4022d2ac55..b5352336b1edf 100644 --- a/tests/target/match.rs +++ b/tests/target/match.rs @@ -149,7 +149,7 @@ fn issue339() { n => {} o => {} p => { - // Dont collapse me + // Don't collapse me } q => {} r => {} diff --git a/tests/target/pattern-condense-wildcards.rs b/tests/target/pattern-condense-wildcards.rs index 39f99d9e123ed..a85a16004ad23 100644 --- a/tests/target/pattern-condense-wildcards.rs +++ b/tests/target/pattern-condense-wildcards.rs @@ -7,6 +7,6 @@ fn main() { Tup(_) => "nah", Quad(_, _, x, _) => " also no rewrite", Quad(x, ..) => "condense me pls", - Weird(x, _, _, /* dont condense before */ ..) => "pls work", + Weird(x, _, _, /* don't condense before */ ..) => "pls work", } } diff --git a/tests/target/remove_blank_lines.rs b/tests/target/remove_blank_lines.rs index 89b18e40b83d2..de74c81ef57f3 100644 --- a/tests/target/remove_blank_lines.rs +++ b/tests/target/remove_blank_lines.rs @@ -20,7 +20,7 @@ fn bar() { let x = 1; // comment after statement - // comment before statment + // comment before statement let y = 2; let z = 3; diff --git a/tests/target/reorder-impl-items.rs b/tests/target/reorder-impl-items.rs index ab008b89d22ac..16efff55b0660 100644 --- a/tests/target/reorder-impl-items.rs +++ b/tests/target/reorder-impl-items.rs @@ -1,6 +1,6 @@ // rustfmt-reorder_impl_items: true -// The ordering of the folllowing impl items should be idempotent. +// The ordering of the following impl items should be idempotent. impl<'a> Command<'a> { pub fn send_to(&self, w: &mut io::Write) -> io::Result<()> { match self {