Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spelling #5753

Merged
merged 26 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some projects don't like changing change logs. Happy to drop.

- 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
Expand Down Expand Up @@ -1031,7 +1031,7 @@ from formatting an attribute #3665

### Changed

- Replace '--conifig-help' with '--config=help' cb10e06
- Replace '--config-help' with '--config=help' cb10e06
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible this means what it said, but I'm guessing it didn't.

- Improve formatting of slice patterns #2912

### Fixed
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doubled words aren't technically misspellings, but spell checkers have traditionally flagged them as well

- Reorder imports by default 164cf7d
- Group `extern crate` by default 3a138a2
- Make `error_on_line_overflow` false by default f146711
Expand Down
2 changes: 1 addition & 1 deletion Configurations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion Processes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions ci/check_diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
jsoref marked this conversation as resolved.
Show resolved Hide resolved
# $OPTIONAL_RUSTFMT_CONFIGS: Optional configs passed to the script from $4
function create_diff() {
local config;
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion intellij.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

brand


### Bind shortcut to "Reformat File with Rustfmt" action

Expand Down
12 changes: 6 additions & 6 deletions src/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/config/config_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl ConfigType for IgnoreList {
}

macro_rules! create_config {
// Options passed in to the macro.
// Options passed into the macro.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in to/into has been quite controversial. It's possible that the phrase pass-in is being treated as a thing in which case I could understand someone objecting, but, I parse this as pass options into container, and thus into is my preference.

//
// - $i: the ident name of the option
// - $ty: the type of the option value
Expand Down
2 changes: 1 addition & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
jsoref marked this conversation as resolved.
Show resolved Hide resolved
if let Some(mut config_dir) = dirs::config_dir() {
config_dir.push("rustfmt");
if let Some(path) = get_toml_path(&config_dir)? {
Expand Down
4 changes: 2 additions & 2 deletions src/config/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down Expand Up @@ -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"]
Expand Down
4 changes: 2 additions & 2 deletions src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/matches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elsewhere, multiline is used a lot. I'm generally performing context-free or line local corrections, and I try to make the simplest correction. If multiline is preferable, I'm happy to apply that change as well.

.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)
Expand Down
2 changes: 1 addition & 1 deletion src/overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/parse/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -104,7 +104,7 @@ impl Emitter for SilentOnIgnoredFilesEmitter {
}
};
}
self.handle_non_ignoreable_error(db);
self.handle_non_ignorable_error(db);
}
}

Expand Down Expand Up @@ -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(
Expand All @@ -190,7 +190,7 @@ impl ParseSess {
) -> Result<ModulePathSuccess, ModError<'_>> {
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.
Expand Down
2 changes: 1 addition & 1 deletion src/test/configuration_snippet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down
2 changes: 1 addition & 1 deletion src/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<RefCell<Vec<(usize, usize)>>>,
pub(crate) macro_rewrite_failure: bool,
pub(crate) report: FormatReport,
Expand Down
Loading