From 1994db5b9db78dd5562dfb163193d61775b5155e Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 24 May 2026 01:20:21 +0000 Subject: [PATCH 01/10] Fix 1 occurrence of `delete-redundant-let` This `let` binding does nothing and can be removed. --- drracket-core-lib/drracket/private/tooltip.rkt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drracket-core-lib/drracket/private/tooltip.rkt b/drracket-core-lib/drracket/private/tooltip.rkt index b2440f28c..aa33b50a0 100644 --- a/drracket-core-lib/drracket/private/tooltip.rkt +++ b/drracket-core-lib/drracket/private/tooltip.rkt @@ -114,14 +114,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) From d9024540f61a2d3b6736a1645839f21bcae35fae Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 24 May 2026 01:20:21 +0000 Subject: [PATCH 02/10] Fix 1 occurrence of `named-let-loop-to-for-in-range` This named `let` expression is equivalent to a `for` loop that uses `in-range`. --- drracket-core-lib/drracket/private/palaka.rkt | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drracket-core-lib/drracket/private/palaka.rkt b/drracket-core-lib/drracket/private/palaka.rkt index 61b97c684..373e8a140 100644 --- a/drracket-core-lib/drracket/private/palaka.rkt +++ b/drracket-core-lib/drracket/private/palaka.rkt @@ -25,14 +25,12 @@ (define alpha (send dc get-alpha)) (send dc set-pen palaka-color 1 'transparent) (for ([dx (in-range (- (/ quadrant-size 2)) w quadrant-size)]) - (let loop ([dy (- (/ quadrant-size 2))]) - (when (< dy h) - (send dc set-alpha 1) - (send dc set-brush palaka-color 'solid) - (send dc draw-rectangle dx dy quadrant-size quadrant-size) - (send dc set-brush "white" 'solid) - (draw-one-palaka dc dx dy) - (loop (+ dy quadrant-size))))) + (for ([dy (in-range (- (/ quadrant-size 2)) h quadrant-size)]) + (send dc set-alpha 1) + (send dc set-brush palaka-color 'solid) + (send dc draw-rectangle dx dy quadrant-size quadrant-size) + (send dc set-brush "white" 'solid) + (draw-one-palaka dc dx dy))) (send dc set-alpha alpha)) (define (draw-one-palaka dc dx dy) From 52468aea0b8c09e79c197fecc2c7bb57e11e2ada Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 24 May 2026 01:20:21 +0000 Subject: [PATCH 03/10] Fix 3 occurrences of `printf-to-display` This use of `printf` has no arguments other than the template string. --- drracket-core-lib/scribble/tools/drracket-buttons.rkt | 4 ++-- drracket-test/tests/drracket/time-keystrokes.rkt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drracket-core-lib/scribble/tools/drracket-buttons.rkt b/drracket-core-lib/scribble/tools/drracket-buttons.rkt index 462d83f99..ead95d229 100644 --- a/drracket-core-lib/scribble/tools/drracket-buttons.rkt +++ b/drracket-core-lib/scribble/tools/drracket-buttons.rkt @@ -44,9 +44,9 @@ ;; if (eval 'doc) goes wrong, then we assume that's because of ;; an earlier failure, so we just don't do anything. (when doc - (printf "scribble: loading xref\n") + (displayln "scribble: loading xref") (define xref ((dynamic-require 'setup/xref 'load-collections-xref))) - (printf "scribble: rendering\n") + (displayln "scribble: rendering") (parameterize ([current-input-port (open-input-string "")]) ((dynamic-require 'scribble/render 'render) (list doc) diff --git a/drracket-test/tests/drracket/time-keystrokes.rkt b/drracket-test/tests/drracket/time-keystrokes.rkt index 6b3471281..c439f5c81 100644 --- a/drracket-test/tests/drracket/time-keystrokes.rkt +++ b/drracket-test/tests/drracket/time-keystrokes.rkt @@ -84,7 +84,7 @@ (loop (send w get-parent) (cons w l))))) (when (getenv "PLTDRKEYS") - (printf "PLTDRKEYS: installing unit frame mixin\n") + (displayln "PLTDRKEYS: installing unit frame mixin") (drracket:get/extend:extend-unit-frame tool-mixin)))) (module+ test From e0140d892c797b7431b3b96463cac0d4373dccd3 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 24 May 2026 01:20:21 +0000 Subject: [PATCH 04/10] Fix 1 occurrence of `hash-set!-ref-to-hash-update!` This expression can be replaced with a simpler, equivalent `hash-update!` expression. --- drracket-core-lib/drracket/sprof.rkt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drracket-core-lib/drracket/sprof.rkt b/drracket-core-lib/drracket/sprof.rkt index bc665d140..e44640ea1 100644 --- a/drracket-core-lib/drracket/sprof.rkt +++ b/drracket-core-lib/drracket/sprof.rkt @@ -18,7 +18,7 @@ (map (λ (t) (continuation-mark-set->context (continuation-marks t))) (get-threads))) (for* ([trace (in-list new-traces)] [line (in-list trace)]) - (hash-set! traces-table line (cons trace (hash-ref traces-table line '())))) + (hash-update! traces-table line (λ (v) (cons trace v)) '())) (cond [(zero? i) (update-gui traces-table) From c84a5a2e86d8ebbf82b3b487a55d812aecca0694 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 24 May 2026 01:20:21 +0000 Subject: [PATCH 05/10] Fix 1 occurrence of `if-let-to-cond` `cond` with internal definitions is preferred over `if` with `let`, to reduce nesting --- .../tests/drracket/private/no-fw-test-util.rkt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drracket-test/tests/drracket/private/no-fw-test-util.rkt b/drracket-test/tests/drracket/private/no-fw-test-util.rkt index 65eaa614d..765b9bce5 100644 --- a/drracket-test/tests/drracket/private/no-fw-test-util.rkt +++ b/drracket-test/tests/drracket/private/no-fw-test-util.rkt @@ -124,13 +124,14 @@ (error 'poll-until "timeout after ~e secs, ~e never returned a true value" secs pred))]) (define step 1/20) (let loop ([counter secs]) - (if (<= counter 0) - (fail) - (let ([result (pred)]) - (or result - (begin - (sleep step) - (loop (- counter step)))))))) + (cond + [(<= counter 0) (fail)] + [else + (define result (pred)) + (or result + (begin + (sleep step) + (loop (- counter step))))]))) (define (wait-for-events-in-frame-eventspace fr) (define sema (make-semaphore 0)) From 43b8d39b2dfc3ad5f0cdab8b456b3a32ecac6902 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 24 May 2026 01:20:21 +0000 Subject: [PATCH 06/10] Fix 1 occurrence of `let-to-define` Internal definitions are recommended instead of `let` expressions, to reduce nesting. --- drracket-core-lib/drracket/private/syncheck-debug.rkt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drracket-core-lib/drracket/private/syncheck-debug.rkt b/drracket-core-lib/drracket/private/syncheck-debug.rkt index 60b7e49c7..84ed825a0 100644 --- a/drracket-core-lib/drracket/private/syncheck-debug.rkt +++ b/drracket-core-lib/drracket/private/syncheck-debug.rkt @@ -109,12 +109,11 @@ (make-modern info-text) (send info-text end-edit-sequence)))) - (let () - (define f (make-object frame% "Syntax 'origin Browser" #f 600 300)) - (define p (make-object horizontal-panel% f)) - (make-object editor-canvas% p output-text) - (make-object editor-canvas% p info-text) - (send f show #t))) + (define f (make-object frame% "Syntax 'origin Browser" #f 600 300)) + (define p (make-object horizontal-panel% f)) + (make-object editor-canvas% p output-text) + (make-object editor-canvas% p info-text) + (send f show #t)) ;; build-ht : stx -> hash-table ;; the resulting hash-table maps from the each sub-object's to its syntax. From af7e2f287660afc5f4f7281a5484d73e444b16b6 Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 24 May 2026 01:20:21 +0000 Subject: [PATCH 07/10] Fix 1 occurrence of `cond-let-to-cond-define` Internal definitions are recommended instead of `let` expressions, to reduce nesting. --- drracket-core-lib/drracket/private/syncheck-debug.rkt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drracket-core-lib/drracket/private/syncheck-debug.rkt b/drracket-core-lib/drracket/private/syncheck-debug.rkt index 84ed825a0..d9b561fb3 100644 --- a/drracket-core-lib/drracket/private/syncheck-debug.rkt +++ b/drracket-core-lib/drracket/private/syncheck-debug.rkt @@ -135,9 +135,9 @@ (hash-set! ht res stx) res)] [else - (let ([res (syntax->datum stx)]) - (hash-set! ht res stx) - res)])) + (define res (syntax->datum stx)) + (hash-set! ht res stx) + res])) ht)) ;; make-text-port : text -> port From 2699ad76f6b51708e124f6cfe43a4ac91d49e2aa Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 24 May 2026 01:20:21 +0000 Subject: [PATCH 08/10] Fix 1 occurrence of `quasiquote-to-list` This quasiquotation is equialent to a simple `list` call. --- .../drracket/find-module-path-completions.rkt | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drracket-tool-text-lib/drracket/find-module-path-completions.rkt b/drracket-tool-text-lib/drracket/find-module-path-completions.rkt index c715ac956..2c4741a0d 100644 --- a/drracket-tool-text-lib/drracket/find-module-path-completions.rkt +++ b/drracket-tool-text-lib/drracket/find-module-path-completions.rkt @@ -183,20 +183,20 @@ (and (regexp? (list-ref link-ent 2)) (regexp-match (list-ref link-ent 2) (version))) #t)) - `(,(list-ref link-ent 0) - ,(simplify-path - (let* ([encoded-path (list-ref link-ent 1)] - [path (cond - [(string? encoded-path) encoded-path] - [(bytes? encoded-path) (bytes->path encoded-path)] - [else (apply build-path - (for/list ([elem (in-list encoded-path)]) - (if (bytes? elem) - (bytes->path-element elem) - elem)))])]) - (if (relative-path? path) - (build-path base path) - path)))))] + (list (list-ref link-ent 0) + (simplify-path (let* ([encoded-path (list-ref link-ent 1)] + [path (cond + [(string? encoded-path) encoded-path] + [(bytes? encoded-path) (bytes->path encoded-path)] + [else + (apply build-path + (for/list ([elem (in-list encoded-path)]) + (if (bytes? elem) + (bytes->path-element elem) + elem)))])]) + (if (relative-path? path) + (build-path base path) + path)))))] [else '()])] [else (for/list ([clp (in-list library-collection-paths)]) From 28125944ebe8b678c46bfdfb7b57d9921d25018f Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 24 May 2026 01:20:21 +0000 Subject: [PATCH 09/10] Fix 1 occurrence of `always-throwing-cond-to-when` Using `when` and `unless` is simpler than a conditional with an always-throwing branch. --- .../tests/drracket/errortrace-startup.rkt | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drracket-test/tests/drracket/errortrace-startup.rkt b/drracket-test/tests/drracket/errortrace-startup.rkt index 5d18d4ff5..3adc78950 100644 --- a/drracket-test/tests/drracket/errortrace-startup.rkt +++ b/drracket-test/tests/drracket/errortrace-startup.rkt @@ -44,18 +44,15 @@ the same ones that drracket is using. (thread (λ () (let loop ([i 10]) - (cond - [(zero? i) - (error 'errortrace-startup.rkt "never saw the drracket frame")] - [else - (define actives (get-top-level-windows)) - (define drracket-frame-found? - (for/or ([active (in-list actives)]) - (and active - (method-in-interface? 'get-execute-button (object-interface active))))) - (unless drracket-frame-found? - (sleep 1) - (loop (- i 1)))])) + (when (zero? i) + (error 'errortrace-startup.rkt "never saw the drracket frame")) + (define actives (get-top-level-windows)) + (define drracket-frame-found? + (for/or ([active (in-list actives)]) + (and active (method-in-interface? 'get-execute-button (object-interface active))))) + (unless drracket-frame-found? + (sleep 1) + (loop (- i 1)))) (semaphore-post sema)))) (void (yield sema)) From 1267da5b87109f4103ea1ad4cb44c5fac43f157b Mon Sep 17 00:00:00 2001 From: "resyntax-ci[bot]" <181813515+resyntax-ci[bot]@users.noreply.github.com> Date: Sun, 24 May 2026 01:20:21 +0000 Subject: [PATCH 10/10] Fix 1 occurrence of `and-let-to-cond` Using `cond` allows converting `let` to internal definitions, reducing nesting --- drracket-test/tests/drracket/private/gui.rkt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drracket-test/tests/drracket/private/gui.rkt b/drracket-test/tests/drracket/private/gui.rkt index 583036354..74cc3bad8 100644 --- a/drracket-test/tests/drracket/private/gui.rkt +++ b/drracket-test/tests/drracket/private/gui.rkt @@ -100,11 +100,11 @@ window label class)) (let loop ([window window]) (cond - [(and (or (not class) - (is-a? window class)) - (let ([win-label (and (is-a? window window<%>) - (send window get-label))]) - (equal? label win-label))) + [(cond + [(or (not class) (is-a? window class)) + (define win-label (and (is-a? window window<%>) (send window get-label))) + (equal? label win-label)] + [else #f]) (list window)] [(is-a? window area-container<%>) (apply append (map loop (send window get-children)))] [else '()])))