From 605f4a57da61bd7ea06acdcf734296f1bbe00a78 Mon Sep 17 00:00:00 2001 From: HongboZhang Date: Mon, 25 Mar 2024 23:10:42 +0800 Subject: [PATCH] Fix formatting in priority_queue.mbt and vec.mbt --- priority_queue/priority_queue.mbt | 2 +- priority_queue/types.mbt | 2 +- vec/vec.mbt | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/priority_queue/priority_queue.mbt b/priority_queue/priority_queue.mbt index 38b65968e..e2783e88a 100644 --- a/priority_queue/priority_queue.mbt +++ b/priority_queue/priority_queue.mbt @@ -267,7 +267,7 @@ test "clear" { /// let is_empty = queue.is_empty() // true /// ``` pub fn is_empty[T](self : PriorityQueue[T]) -> Bool { - self.len == 0 + self.len == 0 } test "is_empty" { diff --git a/priority_queue/types.mbt b/priority_queue/types.mbt index 91278f331..84f1df77b 100644 --- a/priority_queue/types.mbt +++ b/priority_queue/types.mbt @@ -23,4 +23,4 @@ struct PriorityQueue[T] { min : Bool mut len : Int mut top : Node[T] -} \ No newline at end of file +} diff --git a/vec/vec.mbt b/vec/vec.mbt index 0f8dc366d..ac5ef1335 100644 --- a/vec/vec.mbt +++ b/vec/vec.mbt @@ -35,13 +35,12 @@ pub fn to_string[T : Show](self : Vec[T]) -> String { return "Vec::[]" } let first = self.buf[0] - for i = 1, init = "Vec::[\(first)"; ; { - if i < self.len { - let cur = self.buf[i] - continue i + 1, "\(init),\(cur)" - } else { + for i = 1, init = "Vec::[\(first)" { + if i >= self.len { break "\(init)]" } + let cur = self.buf[i] + continue i + 1, "\(init),\(cur)" } }