Skip to content

Commit ec8db6a

Browse files
authored
Remove unused Foundation imports (#2146)
Motivation: A few files unnecesarily import Foundation Modifications: Remove unused imports Result: Fewer dependencies
1 parent e431ed6 commit ec8db6a

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

Sources/GRPCCodeGen/CodeGenerationRequest.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import Foundation
18-
1917
/// Describes the services, dependencies and trivia from an IDL file,
2018
/// and the IDL itself through its specific serializer and deserializer.
2119
public struct CodeGenerationRequest {
@@ -334,7 +332,7 @@ extension Name {
334332
///
335333
/// For example, if `base` is "Foo.Bar", then `normalizedBase` is "Foo_Bar".
336334
public var normalizedBase: String {
337-
return self.base.replacingOccurrences(of: ".", with: "_")
335+
return self.base.replacing(".", with: "_")
338336
}
339337
}
340338

Sources/GRPCCodeGen/Internal/Renderer/TextBasedRenderer.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
// SPDX-License-Identifier: Apache-2.0
2727
//
2828
//===----------------------------------------------------------------------===//
29-
import Foundation
3029

3130
/// An object for building up a generated file line-by-line.
3231
///

Sources/GRPCCodeGen/Internal/Translator/Docs.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
import Foundation
18-
1917
package enum Docs {
2018
package static func suffix(_ header: String, withDocs footer: String) -> String {
2119
if footer.isEmpty {
@@ -58,7 +56,9 @@ package enum Docs {
5856
"""
5957

6058
let body = docs.split(separator: "\n").map { line in
61-
"/// > " + line.dropFirst(4).trimmingCharacters(in: .whitespaces)
59+
var line = "/// > " + line.dropFirst(4)
60+
line.trimPrefix(while: { $0.isWhitespace })
61+
return String(line.drop(while: { $0.isWhitespace }))
6262
}.joined(separator: "\n")
6363

6464
return header + "\n" + body

Sources/GRPCCodeGen/Internal/TypeName.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
// SPDX-License-Identifier: Apache-2.0
2727
//
2828
//===----------------------------------------------------------------------===//
29-
import Foundation
3029

3130
/// A fully-qualified type name that contains the components of the Swift
3231
/// type name.

0 commit comments

Comments
 (0)