Skip to content

Automated Resyntax fixes #441

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

Merged
merged 1 commit into from
Oct 15, 2024
Merged

Automated Resyntax fixes #441

merged 1 commit into from
Oct 15, 2024

Conversation

resyntax-ci[bot]
Copy link
Contributor

@resyntax-ci resyntax-ci bot commented Sep 25, 2024

This is an automated change generated by Resyntax.

Pass 1

Applied 1 fix to scribble-test/tests/scribble/latex-render.rkt

  • Line 3, tidy-require: Keep imports in require sorted and grouped by phase, with collections before files.

Applied 3 fixes to scribble-lib/scribble/lp/lang/common.rkt

  • Line 7, tidy-require: Keep imports in require sorted and grouped by phase, with collections before files.
  • Line 44, if-let-to-cond: cond with internal definitions is preferred over if with let, to reduce nesting
  • Line 59, map-to-for: This map operation can be replaced with a for/list loop.

Applied 1 fix to scribble-test/tests/scribble/text-wrap.rkt

  • Line 3, tidy-require: Keep imports in require sorted and grouped by phase, with collections before files.

Pass 2

Applied 1 fix to scribble-lib/scribble/lp/lang/common.rkt

  • Line 46, if-begin-to-cond: Using cond instead of if here makes begin unnecessary

Summary

Fixed 6 issues in 3 files.

  • Fixed 3 occurrences of tidy-require
  • Fixed 1 occurrence of if-let-to-cond
  • Fixed 1 occurrence of map-to-for
  • Fixed 1 occurrence of if-begin-to-cond

This is an automated change generated by Resyntax.

#### Pass 1

Applied 1 fix to [`scribble-test/tests/scribble/latex-render.rkt`](../blob/HEAD/scribble-test/tests/scribble/latex-render.rkt)

  * Line 3, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.

Applied 3 fixes to [`scribble-lib/scribble/lp/lang/common.rkt`](../blob/HEAD/scribble-lib/scribble/lp/lang/common.rkt)

  * Line 7, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.
  * Line 44, `if-let-to-cond`: `cond` with internal definitions is preferred over `if` with `let`, to reduce nesting
  * Line 59, `map-to-for`: This `map` operation can be replaced with a `for/list` loop.

Applied 1 fix to [`scribble-test/tests/scribble/text-wrap.rkt`](../blob/HEAD/scribble-test/tests/scribble/text-wrap.rkt)

  * Line 3, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files.

#### Pass 2

Applied 1 fix to [`scribble-lib/scribble/lp/lang/common.rkt`](../blob/HEAD/scribble-lib/scribble/lp/lang/common.rkt)

  * Line 46, `if-begin-to-cond`: Using `cond` instead of `if` here makes `begin` unnecessary

## Summary

Fixed 6 issues in 3 files.

  * Fixed 3 occurrences of `tidy-require`
  * Fixed 1 occurrence of `if-let-to-cond`
  * Fixed 1 occurrence of `map-to-for`
  * Fixed 1 occurrence of `if-begin-to-cond`
[else (list (shift expr))])]
[else
(define subs (syntax->list expr))
(if subs (list (restore expr (loop subs))) (list (shift expr)))]))
Copy link
Member

Choose a reason for hiding this comment

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

Kind of wish the if were on its own line here. Not sure if this is already accounted for in a pending change elsewhere, tho!

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorawee and I have some thoughts on how to address this with some future fmt changes. But for now I'd like to just let it be, since I don't think it's worth blocking the rest of the improvements on waiting for that.

Copy link
Member

Choose a reason for hiding this comment

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

okay.

@rfindler
Copy link
Member

The changes look good to me, modulo the one comment.

Comment on lines 58 to +60
(append-map (lambda (m)
(map (lambda (u)
(list (syntax-local-introduce m)
(syntax-local-introduce u)))
(mapping-get chunk-groups m)))
(for/list ([u (in-list (mapping-get chunk-groups m))])
(list (syntax-local-introduce m) (syntax-local-introduce u))))
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be simplified further. Filed jackfirth/resyntax#323 for this.

@mflatt mflatt merged commit 0536f27 into master Oct 15, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants