-
Notifications
You must be signed in to change notification settings - Fork 1k
Respect file-lines range per predicate in where clauses #6874
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
bfc783f
8f10037
528e7ee
638f61c
be33c5b
130d6df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // rustfmt-file_lines: [{"file":"tests/source/file-lines-where-clause.rs","range":[5,5]}] | ||
|
|
||
| fn foo<T, U, V>() | ||
| where | ||
| T: Clone + Debug, | ||
| U: Copy, | ||
| V: Default, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A minor note: The way this test is written it's a bit hard to see what exactly is changing between the source file and target file, since only a single space is changing. I'd suggest changing the input file so that the bad formatting is more obvious, such that it's easier to tell at a glance what the test covers: fn foo<T, U, V>()
where
T : Clone + Debug,
U : Copy,
V : Default,Would then become fn foo<T, U, V>()
where
T: Clone + Debug,
U : Copy,
V : Default, |
||
| { | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // rustfmt-file_lines: [{"file":"tests/source/file-lines-where-clause.rs","range":[5,5]}] | ||
|
|
||
| fn foo<T, U, V>() | ||
| where | ||
| T: Clone + Debug, | ||
| U: Copy, | ||
| V: Default, | ||
| { | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing this check here, I'm wondering if we could move this logic to the Iterator impl for ListItems. It will likely require us to pass the whole
RewriteContexttoitemize_listinstead of just thesnippet_provider, but that should be fine.Moving this check there means that we wouldn't need to duplicate
if out_of_file_lines_range!every time we useitemize_list, and it means that you'd actually fix things for other code paths that use this pattern.View changes since the review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, made a commit, kindly check.