From dd9ca051029885132da6dd8877195140857986b8 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Wed, 18 Sep 2024 02:07:16 +0000 Subject: [PATCH] Automated Resyntax fixes This is an automated change generated by Resyntax. #### Pass 1 Applied 1 fix to [`drracket/drracket/private/syncheck/gui.rkt`](../blob/HEAD/drracket/drracket/private/syncheck/gui.rkt) * Line 21, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files. Applied 4 fixes to [`drracket/drracket/drracket.rkt`](../blob/HEAD/drracket/drracket/drracket.rkt) * Line 2, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files. * Line 26, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. * Line 93, `map-to-for`: This `map` operation can be replaced with a `for/list` loop. * Line 143, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. Applied 2 fixes to [`drracket-tool-text-lib/drracket/private/syncheck/annotate.rkt`](../blob/HEAD/drracket-tool-text-lib/drracket/private/syncheck/annotate.rkt) * Line 13, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. * Line 57, `let-to-define`: Internal definitions are recommended instead of `let` expressions, to reduce nesting. Applied 2 fixes to [`drracket/drracket/private/tooltip.rkt`](../blob/HEAD/drracket/drracket/private/tooltip.rkt) * Line 2, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files. * Line 119, `delete-redundant-let`: This `let` binding does nothing and can be removed. Applied 1 fix to [`drracket/drracket/private/tracing.rkt`](../blob/HEAD/drracket/drracket/private/tracing.rkt) * Line 3, `tidy-require`: Keep imports in `require` sorted and grouped by phase, with collections before files. ## Summary Fixed 10 issues in 5 files. * Fixed 4 occurrences of `tidy-require` * Fixed 4 occurrences of `let-to-define` * Fixed 1 occurrence of `map-to-for` * Fixed 1 occurrence of `delete-redundant-let` --- .../drracket/private/syncheck/annotate.rkt | 16 +++--- drracket/drracket/drracket.rkt | 53 ++++++++----------- drracket/drracket/private/syncheck/gui.rkt | 50 ++++++++--------- drracket/drracket/private/tooltip.rkt | 21 ++++---- drracket/drracket/private/tracing.rkt | 14 ++--- 5 files changed, 72 insertions(+), 82 deletions(-) diff --git a/drracket-tool-text-lib/drracket/private/syncheck/annotate.rkt b/drracket-tool-text-lib/drracket/private/syncheck/annotate.rkt index a1d88c470..6c51cb2c5 100644 --- a/drracket-tool-text-lib/drracket/private/syncheck/annotate.rkt +++ b/drracket-tool-text-lib/drracket/private/syncheck/annotate.rkt @@ -11,12 +11,11 @@ ;; color : syntax[original] str -> void ;; colors the syntax with style-name's style (define (color stx style-name) - (let ([source (find-source-editor stx)]) - (when (and (syntax-position stx) - (syntax-span stx)) - (let ([pos (- (syntax-position stx) 1)] - [span (syntax-span stx)]) - (color-range source pos (+ pos span) style-name))))) + (define source (find-source-editor stx)) + (when (and (syntax-position stx) (syntax-span stx)) + (let ([pos (- (syntax-position stx) 1)] + [span (syntax-span stx)]) + (color-range source pos (+ pos span) style-name)))) ;; color-range : text start finish style-name ;; colors a range in the text based on `style-name' @@ -55,9 +54,8 @@ ;; find-source-editor : stx -> editor or false (define (find-source-editor stx) - (let ([defs-text (current-annotations)]) - (and defs-text - (find-source-editor/defs stx defs-text)))) + (define defs-text (current-annotations)) + (and defs-text (find-source-editor/defs stx defs-text))) ;; find-source-editor : stx text -> editor or false (define (find-source-editor/defs stx defs-text) diff --git a/drracket/drracket/drracket.rkt b/drracket/drracket/drracket.rkt index bb2c621c4..e09bd1466 100644 --- a/drracket/drracket/drracket.rkt +++ b/drracket/drracket/drracket.rkt @@ -1,5 +1,7 @@ #lang racket/base -(require racket/gui/base "private/key.rkt" "private/compiled-dir.rkt") +(require racket/gui/base + "private/compiled-dir.rkt" + "private/key.rkt") (module test racket/base) @@ -24,17 +26,15 @@ (flush-output)) (define (run-trace-thread) - (let ([evt (make-log-receiver (current-logger) 'info)]) - (void - (thread - (λ () - (let loop () - (define vec (sync evt)) - (define str (vector-ref vec 1)) - (when (regexp-match #rx"^cm: *compil(ing|ed)" str) - (display str) - (newline)) - (loop))))))) + (define evt (make-log-receiver (current-logger) 'info)) + (void (thread (λ () + (let loop () + (define vec (sync evt)) + (define str (vector-ref vec 1)) + (when (regexp-match #rx"^cm: *compil(ing|ed)" str) + (display str) + (newline)) + (loop)))))) (cond [debugging? @@ -90,19 +90,12 @@ (define (tool-files id) (apply append - (map - (λ (x) - (define proc (get-info/full x)) - (if proc - (map (λ (dirs) - (apply build-path - x - (if (list? dirs) - dirs - (list dirs)))) - (proc id (λ () '()))) - '())) - (find-relevant-directories (list id))))) + (for/list ([x (in-list (find-relevant-directories (list id)))]) + (define proc (get-info/full x)) + (if proc + (map (λ (dirs) (apply build-path x (if (list? dirs) dirs (list dirs)))) + (proc id (λ () '()))) + '())))) (define make-compilation-manager-load/use-compiled-handler (parameterize ([current-namespace (make-base-empty-namespace)]) @@ -146,11 +139,11 @@ ;; it creates a new custodian and installs it, but the ;; original eventspace was created on the original custodian ;; and this code does not create a new eventspace. - (let ([orig-cust (current-custodian)] - [orig-eventspace (current-eventspace)] - [new-cust (make-custodian)]) - (current-custodian new-cust) - ((dynamic-require 'drracket/private/profile-drs 'start-profile) orig-cust))) + (define orig-cust (current-custodian)) + (define orig-eventspace (current-eventspace)) + (define new-cust (make-custodian)) + (current-custodian new-cust) + ((dynamic-require 'drracket/private/profile-drs 'start-profile) orig-cust)) (dynamic-require 'drracket/private/drracket-normal #f) diff --git a/drracket/drracket/private/syncheck/gui.rkt b/drracket/drracket/private/syncheck/gui.rkt index 194a8df2a..05f0e8db8 100644 --- a/drracket/drracket/private/syncheck/gui.rkt +++ b/drracket/drracket/private/syncheck/gui.rkt @@ -18,39 +18,39 @@ If the namespace does not, they are colored the unbound color. (module+ test (require rackunit)) -(require string-constants - racket/unit - racket/match - racket/contract - racket/class - racket/dict - racket/set - racket/runtime-path - racket/place +(require (for-syntax racket/base) + browser/external data/interval-map + drracket/private/syncheck/annotate + drracket/private/syncheck/colors + drracket/private/syncheck/syncheck-intf + drracket/private/syncheck/traversals drracket/tool - syntax/toplevel - mrlib/switchable-button - (prefix-in drracket:arrow: drracket/arrow) - (prefix-in fw: framework/framework) - mred framework + framework/private/logging-timer framework/private/srcloc-panel + mred + mrlib/switchable-button net/url - browser/external - (for-syntax racket/base) - (only-in ffi/unsafe register-finalizer) - "../../syncheck-drracket-button.rkt" + racket/class + racket/contract + racket/dict + racket/match + racket/place + racket/runtime-path + racket/set + racket/unit + string-constants + syntax/toplevel "../../private/eval-helpers-and-pref-init.rkt" - "intf.rkt" - "local-member-names.rkt" + "../../syncheck-drracket-button.rkt" "../tooltip.rkt" "blueboxes-gui.rkt" - drracket/private/syncheck/syncheck-intf - drracket/private/syncheck/colors - drracket/private/syncheck/traversals - drracket/private/syncheck/annotate - framework/private/logging-timer) + "intf.rkt" + "local-member-names.rkt" + (prefix-in drracket:arrow: drracket/arrow) + (prefix-in fw: framework/framework) + (only-in ffi/unsafe register-finalizer)) (provide tool@) (define orig-output-port (current-output-port)) diff --git a/drracket/drracket/private/tooltip.rkt b/drracket/drracket/private/tooltip.rkt index 64e95c95d..e353f6706 100644 --- a/drracket/drracket/private/tooltip.rkt +++ b/drracket/drracket/private/tooltip.rkt @@ -1,8 +1,8 @@ #lang racket/base -(require racket/math - racket/gui +(require framework racket/class - framework) + racket/gui + racket/math) ;; to bring back types, added "typed/" in front of the ;; racket/* imports, remove these macros and remove the @@ -116,14 +116,13 @@ (init-field [frame-to-track #;#;: (Option (Instance Window<%>)) #f]) (: timer (Option (Instance Timer%))) (define timer - (let ([frame-to-track frame-to-track]) - (and frame-to-track - (new timer% - [notify-callback - (λ () - (unless (send frame-to-track is-shown?) - (show #f) - (send (assert timer) stop)))])))) + (and frame-to-track + (new timer% + [notify-callback + (λ () + (unless (send frame-to-track is-shown?) + (show #f) + (send (assert timer) stop)))]))) (define/override (on-subwindow-event r evt) diff --git a/drracket/drracket/private/tracing.rkt b/drracket/drracket/private/tracing.rkt index e28830d01..7bcc9ed58 100644 --- a/drracket/drracket/private/tracing.rkt +++ b/drracket/drracket/private/tracing.rkt @@ -1,16 +1,16 @@ #lang racket/base -(require racket/contract - racket/unit +(require drracket/private/drsig + framework racket/class + racket/contract + racket/gui/base + racket/list racket/path racket/port - racket/list - racket/gui/base + racket/unit string-constants - framework - (prefix-in tr: trace/stacktrace) - drracket/private/drsig) + (prefix-in tr: trace/stacktrace)) (provide tracing@)