From 2e498380ce57b5e8cc6196db4345c552c9c7bdab Mon Sep 17 00:00:00 2001 From: Chris Araman Date: Fri, 4 Jun 2021 10:01:03 -0700 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Simplify=20max=20length=20?= =?UTF-8?q?calculation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/MasKit/Formatters/SearchResultFormatter.swift | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Sources/MasKit/Formatters/SearchResultFormatter.swift b/Sources/MasKit/Formatters/SearchResultFormatter.swift index 3d0c7d2..568ea94 100644 --- a/Sources/MasKit/Formatters/SearchResultFormatter.swift +++ b/Sources/MasKit/Formatters/SearchResultFormatter.swift @@ -16,10 +16,7 @@ struct SearchResultFormatter { /// - Returns: Multiliune text outoutp. static func format(results: [SearchResult], includePrice: Bool = false) -> String { // find longest appName for formatting, default 50 - let maxLength = - results.map(\.trackName).max(by: { $1.count > $0.count })?.count - ?? 50 - + let maxLength = results.map(\.trackName.count).max() ?? 50 var output: String = "" for result in results {