From 8f461f9f88ec748a0b456c605efd285c8e292663 Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Mon, 13 Jan 2014 17:31:56 -0500 Subject: [PATCH] Replace `chomp` with `string-trim`, delete former --- .../typed-racket-lib/typed-racket/types/printer.rkt | 3 +-- .../typed-racket-lib/typed-racket/utils/string.rkt | 11 ----------- .../typed-racket-lib/typed-racket/utils/tc-utils.rkt | 4 ++-- 3 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/utils/string.rkt diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/printer.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/printer.rkt index 8f985283eb..f99a9342e2 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/printer.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/types/printer.rkt @@ -8,7 +8,6 @@ (prefix-in s: srfi/1) (path-up "rep/type-rep.rkt" "rep/filter-rep.rkt" "rep/object-rep.rkt" "rep/rep-utils.rkt" "types/subtype.rkt" - "utils/string.rkt" "utils/utils.rkt" "utils/tc-utils.rkt") (for-syntax racket/base syntax/parse)) @@ -93,7 +92,7 @@ (write-string (make-string indent #\space) out) (parameterize ([pretty-print-current-style-table type-style-table]) (pretty-display (type->sexp type '()) out)) - (chomp (substring (get-output-string out) indent))) + (string-trim #:left? #f (substring (get-output-string out) indent))) ;; filter->sexp : Filter -> S-expression ;; Print a Filter (see filter-rep.rkt) to the given port diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/utils/string.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/utils/string.rkt deleted file mode 100644 index 7cb3b2996a..0000000000 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/utils/string.rkt +++ /dev/null @@ -1,11 +0,0 @@ -#lang racket/base - -(provide chomp) - -;; removes newline (if any) at end of string -(define (chomp str) - (define len (string-length str)) - (if (eq? #\newline (string-ref str (sub1 len))) - (substring str 0 (sub1 len)) - str)) - diff --git a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/utils/tc-utils.rkt b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/utils/tc-utils.rkt index 3745b92fe8..f41dc8a158 100644 --- a/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/utils/tc-utils.rkt +++ b/pkgs/typed-racket-pkgs/typed-racket-lib/typed-racket/utils/tc-utils.rkt @@ -6,7 +6,6 @@ don't depend on any other portion of the system |# (require syntax/source-syntax "disappeared-use.rkt" - "string.rkt" racket/list racket/match racket/promise racket/string syntax/parse (for-syntax racket/base syntax/parse) (only-in unstable/sequence in-slice)) @@ -159,7 +158,8 @@ don't depend on any other portion of the system (values field-strs* (cons value vals)))) (define more-msg (if more (string-append ";\n " more "\n") "\n")) (define all-fields (string-join (reverse field-strs) "\n")) - (define final-msg (chomp (string-append msg more-msg all-fields))) + (define final-msg + (string-trim #:left? #f (string-append msg more-msg all-fields))) (if delayed? (apply tc-error/delayed #:stx stx final-msg (reverse vals)) (apply tc-error/stx stx final-msg (reverse vals))))