From cedb7b505885f75b1e073f0a0e6c7f2ce6ce5f9b Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Thu, 25 Jan 2024 18:55:23 -0500 Subject: [PATCH] Spelling (#5753) various spelling fixes --------- Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com> --- CHANGELOG.md | 14 +++++++------- Configurations.md | 2 +- Processes.md | 2 +- ci/check_diff.sh | 12 ++++++------ intellij.md | 2 +- src/comment.rs | 12 ++++++------ src/config/config_type.rs | 2 +- src/config/mod.rs | 2 +- src/config/options.rs | 4 ++-- src/imports.rs | 4 ++-- src/items.rs | 4 ++-- src/matches.rs | 4 ++-- src/overflow.rs | 2 +- src/parse/session.rs | 10 +++++----- src/test/configuration_snippet.rs | 2 +- src/visitor.rs | 2 +- 16 files changed, 40 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec4c682d2c4..0a2455dd6de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ } ``` - Prevent ICE when formatting `vec!{}` [#5735](https://github.com/rust-lang/rustfmt/issues/5735) -- Prevent internal trailing whitespace error when formatting an empty `macro_rules!` defintion e.g. `macro_rules! foo {}` [#5882](https://github.com/rust-lang/rustfmt/issues/5882) +- Prevent internal trailing whitespace error when formatting an empty `macro_rules!` definition e.g. `macro_rules! foo {}` [#5882](https://github.com/rust-lang/rustfmt/issues/5882) - Formatting doc comment lines that start with `.` or `)` won't be treated as ordered markdown lists because `.` or `)` must be preceded by a number to start an ordered markdown list [#5835](https://github.com/rust-lang/rustfmt/pull/5835) - Add parenthesis around closures when they're used as method receives, don't have a block body, and end with `.` [#4808](https://github.com/rust-lang/rustfmt/issues/4808) ```rust @@ -184,7 +184,7 @@ - Simplify the rustfmt help text by eliding the full path to the rustfmt binary path from the usage string when running `rustfmt --help` [#5214](https://github.com/rust-lang/rustfmt/issues/5214) -- Bumped the version for serveral dependencies. Most notably `dirs` `v2.0.1` -> `v4.0.0`. This changed the global user config directory on macOS from `$HOME/Library/Preferences` to `$HOME/Library/Application Support` [#5237](https://github.com/rust-lang/rustfmt/pull/5237) +- Bumped the version for several dependencies. Most notably `dirs` `v2.0.1` -> `v4.0.0`. This changed the global user config directory on macOS from `$HOME/Library/Preferences` to `$HOME/Library/Application Support` [#5237](https://github.com/rust-lang/rustfmt/pull/5237) ### Fixed @@ -942,7 +942,7 @@ from formatting an attribute #3665 ### Fixed -- Do not remove path disambiugator inside macro #3142 +- Do not remove path disambiguator inside macro #3142 - Improve handling of Windows newlines #3141 - Fix alignment of a struct's fields (`struct_field_align_threshold` option) with the Visual `indent_style` #3165 - Fix a bug in formatting markdown lists within comments #3172 @@ -1031,7 +1031,7 @@ from formatting an attribute #3665 ### Changed -- Replace '--conifig-help' with '--config=help' cb10e06 +- Replace '--config-help' with '--config=help' cb10e06 - Improve formatting of slice patterns #2912 ### Fixed @@ -1075,7 +1075,7 @@ from formatting an attribute #3665 - Add max_width option for all heuristics c2ae39e - Add config option `format_macro_matchers` to format the metavariable matching patterns in macros 79c5ee8 - Add config option `format_macro_bodies` to format the bodies of macros 79c5ee8 -- Format exitential type fc307ff +- Format existential type fc307ff - Support raw identifiers in struct expressions f121b1a - Format Async block and async function 0b25f60 @@ -1131,7 +1131,7 @@ from formatting an attribute #3665 ### Changed -- Update rustc-ap-syntax to 128.0.0 and ustc-ap-rustc_target to 128.0.0 195395f +- Update rustc-ap-syntax to 128.0.0 and rustc-ap-rustc_target to 128.0.0 195395f - Put operands on its own line when each fits in a single line f8439ce - Improve CLI options 55ac062 1869888 798bffb 4d9de48 eca7796 8396da1 5d9f5aa @@ -1195,7 +1195,7 @@ from formatting an attribute #3665 - Do not collapse block around expr with condition on match arm 5b9b7d5 - Use vertical layout for complex attributes c77708f - Format array using heuristics for function calls 98c6f7b -- Implement stable ordering for impl items with the the following item priority: type, const, macro, then method fa80ddf +- Implement stable ordering for impl items with the following item priority: type, const, macro, then method fa80ddf - Reorder imports by default 164cf7d - Group `extern crate` by default 3a138a2 - Make `error_on_line_overflow` false by default f146711 diff --git a/Configurations.md b/Configurations.md index af7fa012063..78545c6187a 100644 --- a/Configurations.md +++ b/Configurations.md @@ -1673,7 +1673,7 @@ use core::slice; Controls whether arm bodies are wrapped in cases where the first line of the body cannot fit on the same line as the `=>` operator. -The Style Guide requires that bodies are block wrapped by default if a line break is required after the `=>`, but this option can be used to disable that behavior to prevent wrapping arm bodies in that event, so long as the body does not contain multiple statements nor line comments. +The Style Guide requires that bodies are block wrapped by default if a line break is required after the `=>`, but this option can be used to disable that behavior to prevent wrapping arm bodies in that event, so long as the body contains neither multiple statements nor line comments. - **Default value**: `true` - **Possible values**: `true`, `false` diff --git a/Processes.md b/Processes.md index 61abc87eec9..64ef20a9bd7 100644 --- a/Processes.md +++ b/Processes.md @@ -16,7 +16,7 @@ In this Section, we describe how to stabilise an option of the rustfmt's configu Open a pull request that closes the tracking issue. The tracking issue is listed beside the option in `Configurations.md`. - Update the `Config` enum marking the option as stable. -- Update the the `Configuration.md` file marking the option as stable. +- Update the `Configuration.md` file marking the option as stable. - Update `CHANGELOG.md` marking the option as stable. ## After the stabilisation diff --git a/ci/check_diff.sh b/ci/check_diff.sh index 42fdcaa6424..93de6040339 100755 --- a/ci/check_diff.sh +++ b/ci/check_diff.sh @@ -28,7 +28,7 @@ function clone_repo() { GIT_TERMINAL_PROMPT=0 git clone --quiet $1 --depth 1 $2 && cd $2 } -# Initialize Git submoduels for the repo. +# Initialize Git submodules for the repo. # # Parameters # $1: list of directories to initialize @@ -43,7 +43,7 @@ function init_submodules() { # $2: Output file path for the diff # $3: Any additional configuration options to pass to rustfmt # -# Globlas: +# Globals: # $OPTIONAL_RUSTFMT_CONFIGS: Optional configs passed to the script from $4 function create_diff() { local config; @@ -64,7 +64,7 @@ function create_diff() { # Parameters # $1: Name of the repository (used for logging) # -# Globlas: +# Globals: # $RUSFMT_BIN: Path to the rustfmt master binary. Created when running `compile_rustfmt` # $FEATURE_BIN: Path to the rustfmt feature binary. Created when running `compile_rustfmt` # $OPTIONAL_RUSTFMT_CONFIGS: Optional configs passed to the script from $4 @@ -101,7 +101,7 @@ function check_diff() { # Parameters: # $1: Directory where rustfmt will be cloned # -# Globlas: +# Globals: # $REMOTE_REPO: Clone URL to the rustfmt fork that we want to test # $FEATURE_BRANCH: Name of the feature branch # $OPTIONAL_COMMIT_HASH: Optional commit hash that will be checked out if provided @@ -111,8 +111,8 @@ function compile_rustfmt() { git remote add feature $REMOTE_REPO git fetch feature $FEATURE_BRANCH - CARGO_VERSON=$(cargo --version) - echo -e "\ncompiling with $CARGO_VERSON\n" + CARGO_VERSION=$(cargo --version) + echo -e "\ncompiling with $CARGO_VERSION\n" # Because we're building standalone binaries we need to set `LD_LIBRARY_PATH` so each # binary can find it's runtime dependencies. See https://github.com/rust-lang/rustfmt/issues/5675 diff --git a/intellij.md b/intellij.md index 6a711c0171a..70170df388f 100644 --- a/intellij.md +++ b/intellij.md @@ -20,7 +20,7 @@ - Open Rustfmt settings (File → Settings → Languages & Frameworks → Rust → Rustfmt) and enable "Run rustfmt on Save" ![run_rustfmt_on_save](https://user-images.githubusercontent.com/6505554/83944610-3468f380-a81e-11ea-9c34-0cbd18dd4969.png) -- IntellJ uses autosave, so now your files will always be formatted according to rustfmt. Alternatively you can use Ctrl+S to reformat file manually +- IntelliJ uses autosave, so now your files will always be formatted according to rustfmt. Alternatively you can use Ctrl+S to reformat file manually ### Bind shortcut to "Reformat File with Rustfmt" action diff --git a/src/comment.rs b/src/comment.rs index da17bc66b44..55e710bd27d 100644 --- a/src/comment.rs +++ b/src/comment.rs @@ -205,7 +205,7 @@ pub(crate) fn combine_strs_with_missing_comments( // We have a missing comment between the first expression and the second expression. - // Peek the the original source code and find out whether there is a newline between the first + // Peek the original source code and find out whether there is a newline between the first // expression and the second expression or the missing comment. We will preserve the original // layout whenever possible. let original_snippet = context.snippet(span); @@ -663,7 +663,7 @@ impl<'a> CommentRewrite<'a> { } /// Check if any characters were written to the result buffer after the start of the comment. - /// when calling [`CommentRewrite::new()`] the result buffer is initiazlied with the opening + /// when calling [`CommentRewrite::new()`] the result buffer is initialized with the opening /// characters for the comment. fn buffer_contains_comment(&self) -> bool { // if self.result.len() < self.opener.len() then an empty comment is in the buffer @@ -1260,15 +1260,15 @@ pub(crate) enum FullCodeCharKind { InComment, /// Last character of a comment, '\n' for a line comment, '/' for a block comment. EndComment, - /// Start of a mutlitine string inside a comment + /// Start of a multiline string inside a comment StartStringCommented, - /// End of a mutlitine string inside a comment + /// End of a multiline string inside a comment EndStringCommented, /// Inside a commented string InStringCommented, - /// Start of a mutlitine string + /// Start of a multiline string StartString, - /// End of a mutlitine string + /// End of a multiline string EndString, /// Inside a string. InString, diff --git a/src/config/config_type.rs b/src/config/config_type.rs index 7551241fc00..f7cff1a1729 100644 --- a/src/config/config_type.rs +++ b/src/config/config_type.rs @@ -66,7 +66,7 @@ impl ConfigType for IgnoreList { } macro_rules! create_config { - // Options passed in to the macro. + // Options passed into the macro. // // - $i: the ident name of the option // - $ty: the type of the option value diff --git a/src/config/mod.rs b/src/config/mod.rs index c7c2d4e48a8..9484b2e5829 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -287,7 +287,7 @@ impl Config { } } - // If none was found ther either, check in the user's configuration directory. + // If none was found there either, check in the user's configuration directory. if let Some(mut config_dir) = dirs::config_dir() { config_dir.push("rustfmt"); if let Some(path) = get_toml_path(&config_dir)? { diff --git a/src/config/options.rs b/src/config/options.rs index e7fd2cfbd31..3c5c713a33a 100644 --- a/src/config/options.rs +++ b/src/config/options.rs @@ -191,7 +191,7 @@ pub enum Color { pub enum Version { /// 1.x.y. When specified, rustfmt will format in the same style as 1.0.0. One, - /// 2.x.y. When specified, rustfmt will format in the the latest style. + /// 2.x.y. When specified, rustfmt will format in the latest style. Two, } @@ -416,7 +416,7 @@ pub trait CliOptions { fn config_path(&self) -> Option<&Path>; } -/// The edition of the syntax and semntics of code (RFC 2052). +/// The edition of the syntax and semantics of code (RFC 2052). #[config_type] pub enum Edition { #[value = "2015"] diff --git a/src/imports.rs b/src/imports.rs index 09f6e752338..05195553c08 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -683,9 +683,9 @@ impl UseTree { let prefix = &self.path[..self.path.len() - 1]; let mut result = vec![]; for nested_use_tree in list { - for flattend in &mut nested_use_tree.clone().flatten(import_granularity) { + for flattened in &mut nested_use_tree.clone().flatten(import_granularity) { let mut new_path = prefix.to_vec(); - new_path.append(&mut flattend.path); + new_path.append(&mut flattened.path); result.push(UseTree { path: new_path, span: self.span, diff --git a/src/items.rs b/src/items.rs index c6976324c71..8669bdda32b 100644 --- a/src/items.rs +++ b/src/items.rs @@ -2506,7 +2506,7 @@ fn rewrite_fn_base( || context.config.indent_style() == IndentStyle::Visual { let indent = if param_str.is_empty() { - // Aligning with non-existent params looks silly. + // Aligning with nonexistent params looks silly. force_new_line_for_brace = true; indent + 4 } else { @@ -2521,7 +2521,7 @@ fn rewrite_fn_base( } else { let mut ret_shape = Shape::indented(indent, context.config); if param_str.is_empty() { - // Aligning with non-existent params looks silly. + // Aligning with nonexistent params looks silly. force_new_line_for_brace = true; ret_shape = if context.use_block_indent() { ret_shape.offset_left(4).unwrap_or(ret_shape) diff --git a/src/matches.rs b/src/matches.rs index 72386f0a097..5e36d9e857d 100644 --- a/src/matches.rs +++ b/src/matches.rs @@ -339,10 +339,10 @@ fn flatten_arm_body<'a>( (true, body) } } else { - let cond_becomes_muti_line = opt_shape + let cond_becomes_multi_line = opt_shape .and_then(|shape| rewrite_cond(context, expr, shape)) .map_or(false, |cond| cond.contains('\n')); - if cond_becomes_muti_line { + if cond_becomes_multi_line { (false, &*body) } else { (can_extend(expr), &*expr) diff --git a/src/overflow.rs b/src/overflow.rs index 2f9705ec943..c44f3788d97 100644 --- a/src/overflow.rs +++ b/src/overflow.rs @@ -523,7 +523,7 @@ impl<'a> Context<'a> { // However, when the inner function has a prefix or a suffix // (e.g., `foo() as u32`), this budget reduction may produce poorly // formatted code, where a prefix or a suffix being left on its own - // line. Here we explicitlly check those cases. + // line. Here we explicitly check those cases. if count_newlines(overflowed) == 1 { let rw = self .items diff --git a/src/parse/session.rs b/src/parse/session.rs index 646d2d132a8..5de6ee49acf 100644 --- a/src/parse/session.rs +++ b/src/parse/session.rs @@ -62,7 +62,7 @@ struct SilentOnIgnoredFilesEmitter { } impl SilentOnIgnoredFilesEmitter { - fn handle_non_ignoreable_error(&mut self, db: &Diagnostic) { + fn handle_non_ignorable_error(&mut self, db: &Diagnostic) { self.has_non_ignorable_parser_errors = true; self.can_reset.store(false, Ordering::Release); self.emitter.emit_diagnostic(db); @@ -86,7 +86,7 @@ impl Emitter for SilentOnIgnoredFilesEmitter { fn emit_diagnostic(&mut self, db: &Diagnostic) { if db.level() == DiagnosticLevel::Fatal { - return self.handle_non_ignoreable_error(db); + return self.handle_non_ignorable_error(db); } if let Some(primary_span) = &db.span.primary_span() { let file_name = self.source_map.span_to_filename(*primary_span); @@ -104,7 +104,7 @@ impl Emitter for SilentOnIgnoredFilesEmitter { } }; } - self.handle_non_ignoreable_error(db); + self.handle_non_ignorable_error(db); } } @@ -179,7 +179,7 @@ impl ParseSess { /// /// * `id` - The name of the module /// * `relative` - If Some(symbol), the symbol name is a directory relative to the dir_path. - /// If relative is Some, resolve the submodle at {dir_path}/{symbol}/{id}.rs + /// If relative is Some, resolve the submodule at {dir_path}/{symbol}/{id}.rs /// or {dir_path}/{symbol}/{id}/mod.rs. if None, resolve the module at {dir_path}/{id}.rs. /// * `dir_path` - Module resolution will occur relative to this directory. pub(crate) fn default_submod_path( @@ -190,7 +190,7 @@ impl ParseSess { ) -> Result> { rustc_expand::module::default_submod_path(&self.parse_sess, id, relative, dir_path).or_else( |e| { - // If resloving a module relative to {dir_path}/{symbol} fails because a file + // If resolving a module relative to {dir_path}/{symbol} fails because a file // could not be found, then try to resolve the module relative to {dir_path}. // If we still can't find the module after searching for it in {dir_path}, // surface the original error. diff --git a/src/test/configuration_snippet.rs b/src/test/configuration_snippet.rs index 80b61c88a00..857fff5cf6b 100644 --- a/src/test/configuration_snippet.rs +++ b/src/test/configuration_snippet.rs @@ -208,7 +208,7 @@ impl ConfigCodeBlock { } // Extract a code block from the iterator. Behavior: - // - Rust code blocks are identifed by lines beginning with "```rust". + // - Rust code blocks are identified by lines beginning with "```rust". // - One explicit configuration setting is supported per code block. // - Rust code blocks with no configuration setting are illegal and cause an // assertion failure, unless the snippet begins with #![rustfmt::skip]. diff --git a/src/visitor.rs b/src/visitor.rs index f4d84d1381f..61e147ed8f5 100644 --- a/src/visitor.rs +++ b/src/visitor.rs @@ -81,7 +81,7 @@ pub(crate) struct FmtVisitor<'a> { pub(crate) snippet_provider: &'a SnippetProvider, pub(crate) line_number: usize, /// List of 1-based line ranges which were annotated with skip - /// Both bounds are inclusifs. + /// Both bounds are inclusive. pub(crate) skipped_range: Rc>>, pub(crate) macro_rewrite_failure: bool, pub(crate) report: FormatReport,