Skip to content

Commit 87f8e49

Browse files
committed
Assign rawValue instead of self
1 parent c2e385e commit 87f8e49

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Sources/System/FileSystem/Stat.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public struct Stat: RawRepresentable, Sendable {
102102
followTargetSymlink: Bool = true,
103103
retryOnInterrupt: Bool = true
104104
) throws(Errno) {
105-
self = try path.withPlatformString {
105+
self.rawValue = try path.withPlatformString {
106106
Self._stat(
107107
$0,
108108
followTargetSymlink: followTargetSymlink,
@@ -125,7 +125,7 @@ public struct Stat: RawRepresentable, Sendable {
125125
followTargetSymlink: Bool = true,
126126
retryOnInterrupt: Bool = true
127127
) throws(Errno) {
128-
self = try Self._stat(
128+
self.rawValue = try Self._stat(
129129
path,
130130
followTargetSymlink: followTargetSymlink,
131131
retryOnInterrupt: retryOnInterrupt
@@ -137,15 +137,15 @@ public struct Stat: RawRepresentable, Sendable {
137137
_ ptr: UnsafePointer<CChar>,
138138
followTargetSymlink: Bool,
139139
retryOnInterrupt: Bool
140-
) -> Result<Stat, Errno> {
140+
) -> Result<CInterop.Stat, Errno> {
141141
var result = CInterop.Stat()
142142
return nothingOrErrno(retryOnInterrupt: retryOnInterrupt) {
143143
if followTargetSymlink {
144144
system_stat(ptr, &result)
145145
} else {
146146
system_lstat(ptr, &result)
147147
}
148-
}.map { Stat(rawValue: result) }
148+
}.map { result }
149149
}
150150

151151
/// Creates a `Stat` struct from a `FileDescriptor`.
@@ -156,7 +156,7 @@ public struct Stat: RawRepresentable, Sendable {
156156
_ fd: FileDescriptor,
157157
retryOnInterrupt: Bool = true
158158
) throws(Errno) {
159-
self = try Self._fstat(
159+
self.rawValue = try Self._fstat(
160160
fd,
161161
retryOnInterrupt: retryOnInterrupt
162162
).get()
@@ -166,11 +166,11 @@ public struct Stat: RawRepresentable, Sendable {
166166
internal static func _fstat(
167167
_ fd: FileDescriptor,
168168
retryOnInterrupt: Bool
169-
) -> Result<Stat, Errno> {
169+
) -> Result<CInterop.Stat, Errno> {
170170
var result = CInterop.Stat()
171171
return nothingOrErrno(retryOnInterrupt: retryOnInterrupt) {
172172
system_fstat(fd.rawValue, &result)
173-
}.map { Stat(rawValue: result) }
173+
}.map { result }
174174
}
175175

176176
/// Creates a `Stat` struct from a `FilePath` and `Flags`.
@@ -184,7 +184,7 @@ public struct Stat: RawRepresentable, Sendable {
184184
flags: Stat.Flags,
185185
retryOnInterrupt: Bool = true
186186
) throws(Errno) {
187-
self = try path.withPlatformString {
187+
self.rawValue = try path.withPlatformString {
188188
Self._fstatat(
189189
$0,
190190
relativeTo: _AT_FDCWD,
@@ -208,7 +208,7 @@ public struct Stat: RawRepresentable, Sendable {
208208
flags: Stat.Flags,
209209
retryOnInterrupt: Bool = true
210210
) throws(Errno) {
211-
self = try path.withPlatformString {
211+
self.rawValue = try path.withPlatformString {
212212
Self._fstatat(
213213
$0,
214214
relativeTo: fd.rawValue,
@@ -229,7 +229,7 @@ public struct Stat: RawRepresentable, Sendable {
229229
flags: Stat.Flags,
230230
retryOnInterrupt: Bool = true
231231
) throws(Errno) {
232-
self = try Self._fstatat(
232+
self.rawValue = try Self._fstatat(
233233
path,
234234
relativeTo: _AT_FDCWD,
235235
flags: flags,
@@ -251,7 +251,7 @@ public struct Stat: RawRepresentable, Sendable {
251251
flags: Stat.Flags,
252252
retryOnInterrupt: Bool = true
253253
) throws(Errno) {
254-
self = try Self._fstatat(
254+
self.rawValue = try Self._fstatat(
255255
path,
256256
relativeTo: fd.rawValue,
257257
flags: flags,
@@ -265,11 +265,11 @@ public struct Stat: RawRepresentable, Sendable {
265265
relativeTo fd: FileDescriptor.RawValue,
266266
flags: Stat.Flags,
267267
retryOnInterrupt: Bool
268-
) -> Result<Stat, Errno> {
268+
) -> Result<CInterop.Stat, Errno> {
269269
var result = CInterop.Stat()
270270
return nothingOrErrno(retryOnInterrupt: retryOnInterrupt) {
271271
system_fstatat(fd, path, &result, flags.rawValue)
272-
}.map { Stat(rawValue: result) }
272+
}.map { result }
273273
}
274274

275275

0 commit comments

Comments
 (0)