@@ -45,7 +45,7 @@ extension std.string {
45
45
unsafe self. init ( str, UTF8 . _nullCodeUnitOffset ( in: str) , . init( ) )
46
46
#endif
47
47
} else {
48
- unsafe self. init ( )
48
+ self . init ( )
49
49
}
50
50
}
51
51
}
@@ -58,9 +58,9 @@ extension std.u16string {
58
58
/// Swift string.
59
59
@_alwaysEmitIntoClient
60
60
public init ( _ string: String ) {
61
- unsafe self. init ( )
61
+ self . init ( )
62
62
for char in string. utf16 {
63
- unsafe self. push_back ( char)
63
+ self . push_back ( char)
64
64
}
65
65
}
66
66
}
@@ -73,9 +73,9 @@ extension std.u32string {
73
73
/// Swift string.
74
74
@_alwaysEmitIntoClient
75
75
public init ( _ string: String ) {
76
- unsafe self. init ( )
76
+ self . init ( )
77
77
for char in string. unicodeScalars {
78
- unsafe self. push_back ( char)
78
+ self . push_back ( char)
79
79
}
80
80
}
81
81
}
@@ -87,7 +87,7 @@ extension std.string: ExpressibleByStringLiteral,
87
87
88
88
@_alwaysEmitIntoClient
89
89
public init ( stringLiteral value: String ) {
90
- unsafe self. init ( value)
90
+ self . init ( value)
91
91
}
92
92
}
93
93
@@ -96,7 +96,7 @@ extension std.u16string: ExpressibleByStringLiteral,
96
96
97
97
@_alwaysEmitIntoClient
98
98
public init ( stringLiteral value: String ) {
99
- unsafe self. init ( value)
99
+ self . init ( value)
100
100
}
101
101
}
102
102
@@ -105,7 +105,7 @@ extension std.u32string: ExpressibleByStringLiteral,
105
105
106
106
@_alwaysEmitIntoClient
107
107
public init ( stringLiteral value: String ) {
108
- unsafe self. init ( value)
108
+ self . init ( value)
109
109
}
110
110
}
111
111
@@ -114,17 +114,17 @@ extension std.u32string: ExpressibleByStringLiteral,
114
114
extension std . string : Equatable , Comparable {
115
115
@_alwaysEmitIntoClient
116
116
public static func == ( lhs: std . string , rhs: std . string ) -> Bool {
117
- return unsafe lhs. compare ( rhs) == 0
117
+ return lhs. compare ( rhs) == 0
118
118
}
119
119
120
120
@_alwaysEmitIntoClient
121
121
public static func < ( lhs: std . string , rhs: std . string ) -> Bool {
122
- return unsafe lhs. compare ( rhs) < 0
122
+ return lhs. compare ( rhs) < 0
123
123
}
124
124
125
125
@_alwaysEmitIntoClient
126
126
public static func += ( lhs: inout std . string , rhs: std . string ) {
127
- unsafe lhs. append ( rhs)
127
+ lhs. append ( rhs)
128
128
}
129
129
130
130
@_alwaysEmitIntoClient
@@ -134,26 +134,26 @@ extension std.string: Equatable, Comparable {
134
134
135
135
@_alwaysEmitIntoClient
136
136
public static func + ( lhs: std . string , rhs: std . string ) -> std . string {
137
- var copy = unsafe lhs
138
- unsafe copy += rhs
139
- return unsafe copy
137
+ var copy = lhs
138
+ copy += rhs
139
+ return copy
140
140
}
141
141
}
142
142
143
143
extension std . u16string : Equatable , Comparable {
144
144
@_alwaysEmitIntoClient
145
145
public static func == ( lhs: std . u16string , rhs: std . u16string ) -> Bool {
146
- return unsafe lhs. compare ( rhs) == 0
146
+ return lhs. compare ( rhs) == 0
147
147
}
148
148
149
149
@_alwaysEmitIntoClient
150
150
public static func < ( lhs: std . u16string , rhs: std . u16string ) -> Bool {
151
- return unsafe lhs. compare ( rhs) < 0
151
+ return lhs. compare ( rhs) < 0
152
152
}
153
153
154
154
@_alwaysEmitIntoClient
155
155
public static func += ( lhs: inout std . u16string , rhs: std . u16string ) {
156
- unsafe lhs. append ( rhs)
156
+ lhs. append ( rhs)
157
157
}
158
158
159
159
@_alwaysEmitIntoClient
@@ -163,26 +163,26 @@ extension std.u16string: Equatable, Comparable {
163
163
164
164
@_alwaysEmitIntoClient
165
165
public static func + ( lhs: std . u16string , rhs: std . u16string ) -> std . u16string {
166
- var copy = unsafe lhs
167
- unsafe copy += rhs
168
- return unsafe copy
166
+ var copy = lhs
167
+ copy += rhs
168
+ return copy
169
169
}
170
170
}
171
171
172
172
extension std . u32string : Equatable , Comparable {
173
173
@_alwaysEmitIntoClient
174
174
public static func == ( lhs: std . u32string , rhs: std . u32string ) -> Bool {
175
- return unsafe lhs. compare ( rhs) == 0
175
+ return lhs. compare ( rhs) == 0
176
176
}
177
177
178
178
@_alwaysEmitIntoClient
179
179
public static func < ( lhs: std . u32string , rhs: std . u32string ) -> Bool {
180
- return unsafe lhs. compare ( rhs) < 0
180
+ return lhs. compare ( rhs) < 0
181
181
}
182
182
183
183
@_alwaysEmitIntoClient
184
184
public static func += ( lhs: inout std . u32string , rhs: std . u32string ) {
185
- unsafe lhs. append ( rhs)
185
+ lhs. append ( rhs)
186
186
}
187
187
188
188
@_alwaysEmitIntoClient
@@ -192,9 +192,9 @@ extension std.u32string: Equatable, Comparable {
192
192
193
193
@_alwaysEmitIntoClient
194
194
public static func + ( lhs: std . u32string , rhs: std . u32string ) -> std . u32string {
195
- var copy = unsafe lhs
196
- unsafe copy += rhs
197
- return unsafe copy
195
+ var copy = lhs
196
+ copy += rhs
197
+ return copy
198
198
}
199
199
}
200
200
@@ -204,7 +204,7 @@ extension std.string: Hashable {
204
204
@_alwaysEmitIntoClient
205
205
public func hash( into hasher: inout Hasher ) {
206
206
// Call std::hash<std::string>::operator()
207
- let cxxHash = unsafe __swift_interopComputeHashOfString( self )
207
+ let cxxHash = __swift_interopComputeHashOfString ( self )
208
208
hasher. combine ( cxxHash)
209
209
}
210
210
}
@@ -213,7 +213,7 @@ extension std.u16string: Hashable {
213
213
@_alwaysEmitIntoClient
214
214
public func hash( into hasher: inout Hasher ) {
215
215
// Call std::hash<std::u16string>::operator()
216
- let cxxHash = unsafe __swift_interopComputeHashOfU16String( self )
216
+ let cxxHash = __swift_interopComputeHashOfU16String ( self )
217
217
hasher. combine ( cxxHash)
218
218
}
219
219
}
@@ -222,7 +222,7 @@ extension std.u32string: Hashable {
222
222
@_alwaysEmitIntoClient
223
223
public func hash( into hasher: inout Hasher ) {
224
224
// Call std::hash<std::u32string>::operator()
225
- let cxxHash = unsafe __swift_interopComputeHashOfU32String( self )
225
+ let cxxHash = __swift_interopComputeHashOfU32String ( self )
226
226
hasher. combine ( cxxHash)
227
227
}
228
228
}
@@ -232,42 +232,42 @@ extension std.u32string: Hashable {
232
232
extension std . string : CustomDebugStringConvertible {
233
233
@_alwaysEmitIntoClient
234
234
public var debugDescription : String {
235
- return " std.string( \( unsafe String( self ) ) ) "
235
+ return " std.string( \( String ( self ) ) ) "
236
236
}
237
237
}
238
238
239
239
extension std . u16string : CustomDebugStringConvertible {
240
240
@_alwaysEmitIntoClient
241
241
public var debugDescription : String {
242
- return " std.u16string( \( unsafe String( self ) ) ) "
242
+ return " std.u16string( \( String ( self ) ) ) "
243
243
}
244
244
}
245
245
246
246
extension std . u32string : CustomDebugStringConvertible {
247
247
@_alwaysEmitIntoClient
248
248
public var debugDescription : String {
249
- return " std.u32string( \( unsafe String( self ) ) ) "
249
+ return " std.u32string( \( String ( self ) ) ) "
250
250
}
251
251
}
252
252
253
253
extension std . string : CustomStringConvertible {
254
254
@_alwaysEmitIntoClient
255
255
public var description : String {
256
- return unsafe String( self )
256
+ return String ( self )
257
257
}
258
258
}
259
259
260
260
extension std . u16string : CustomStringConvertible {
261
261
@_alwaysEmitIntoClient
262
262
public var description : String {
263
- return unsafe String( self )
263
+ return String ( self )
264
264
}
265
265
}
266
266
267
267
extension std . u32string : CustomStringConvertible {
268
268
@_alwaysEmitIntoClient
269
269
public var description : String {
270
- return unsafe String( self )
270
+ return String ( self )
271
271
}
272
272
}
273
273
@@ -289,7 +289,7 @@ extension String {
289
289
self = unsafe buffer. withMemoryRebound ( to: UInt8 . self) {
290
290
unsafe String( decoding: $0, as: UTF8 . self)
291
291
}
292
- unsafe withExtendedLifetime ( cxxString) { }
292
+ withExtendedLifetime ( cxxString) { }
293
293
}
294
294
295
295
/// Creates a String having the same content as the given C++ UTF-16 string.
@@ -306,7 +306,7 @@ extension String {
306
306
start: cxxU16String. __dataUnsafe ( ) ,
307
307
count: cxxU16String. size ( ) )
308
308
self = unsafe String( decoding: buffer, as: UTF16 . self)
309
- unsafe withExtendedLifetime ( cxxU16String) { }
309
+ withExtendedLifetime ( cxxU16String) { }
310
310
}
311
311
312
312
/// Creates a String having the same content as the given C++ UTF-32 string.
@@ -325,7 +325,7 @@ extension String {
325
325
self = unsafe buffer. withMemoryRebound ( to: UInt32 . self) {
326
326
unsafe String( decoding: $0, as: UTF32 . self)
327
327
}
328
- unsafe withExtendedLifetime ( cxxU32String) { }
328
+ withExtendedLifetime ( cxxU32String) { }
329
329
}
330
330
}
331
331
0 commit comments