Skip to content

Commit 8ad25ac

Browse files
committed
use lowercase io error messages in vexos modules
1 parent eec6756 commit 8ad25ac

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

library/std/src/sys/fs/vexos.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@ impl File {
201201
let status = unsafe { vex_sdk::vexFileStatus(path.as_ptr()) };
202202

203203
if opts.create_new && status != 0 {
204-
return Err(io::const_error!(io::ErrorKind::AlreadyExists, "File exists",));
204+
return Err(io::const_error!(io::ErrorKind::AlreadyExists, "file exists",));
205205
} else if !opts.create && status == 0 {
206206
return Err(io::const_error!(
207207
io::ErrorKind::NotFound,
208-
"No such file or directory",
208+
"no such file or directory",
209209
));
210210
}
211211
}
@@ -215,7 +215,7 @@ impl File {
215215
OpenOptions { read: true, write: true, .. } => {
216216
return Err(io::const_error!(
217217
io::ErrorKind::InvalidInput,
218-
"Opening files with read and write access is unsupported on this target",
218+
"opening files with read and write access is unsupported on this target",
219219
));
220220
}
221221

@@ -259,12 +259,12 @@ impl File {
259259
},
260260

261261
_ => {
262-
return Err(io::const_error!(io::ErrorKind::InvalidInput, "Invalid argument"));
262+
return Err(io::const_error!(io::ErrorKind::InvalidInput, "invalid argument"));
263263
}
264264
};
265265

266266
if file.is_null() {
267-
Err(io::const_error!(io::ErrorKind::NotFound, "Could not open file"))
267+
Err(io::const_error!(io::ErrorKind::NotFound, "could not open file"))
268268
} else {
269269
Ok(Self { fd: FileDesc(file) })
270270
}
@@ -279,7 +279,7 @@ impl File {
279279
}) {
280280
Ok(FileAttr::File { size })
281281
} else {
282-
Err(io::const_error!(io::ErrorKind::InvalidData, "Failed to get file size"))
282+
Err(io::const_error!(io::ErrorKind::InvalidData, "failed to get file size"))
283283
}
284284
}
285285

@@ -324,7 +324,7 @@ impl File {
324324
};
325325

326326
if read < 0 {
327-
Err(io::const_error!(io::ErrorKind::Other, "Could not read from file"))
327+
Err(io::const_error!(io::ErrorKind::Other, "could not read from file"))
328328
} else {
329329
Ok(read as usize)
330330
}
@@ -352,7 +352,7 @@ impl File {
352352
};
353353

354354
if written < 0 {
355-
Err(io::const_error!(io::ErrorKind::Other, "Could not write to file"))
355+
Err(io::const_error!(io::ErrorKind::Other, "could not write to file"))
356356
} else {
357357
Ok(written as usize)
358358
}
@@ -380,7 +380,7 @@ impl File {
380380
let position = unsafe { vex_sdk::vexFileTell(self.fd.0) };
381381

382382
position.try_into().map_err(|_| {
383-
io::const_error!(io::ErrorKind::InvalidData, "Failed to get current location in file")
383+
io::const_error!(io::ErrorKind::InvalidData, "failed to get current location in file")
384384
})
385385
}
386386

@@ -397,7 +397,7 @@ impl File {
397397
offset.try_into().map_err(|_| {
398398
io::const_error!(
399399
io::ErrorKind::InvalidInput,
400-
"Cannot seek to an offset too large to fit in a 32 bit integer",
400+
"cannot seek to an offset too large to fit in a 32 bit integer",
401401
)
402402
})
403403
}
@@ -497,7 +497,8 @@ pub fn exists(path: &Path) -> io::Result<bool> {
497497
}
498498

499499
pub fn stat(p: &Path) -> io::Result<FileAttr> {
500-
// `vexFileStatus` returns 3 if the given path is a directory.
500+
// `vexFileStatus` returns 3 if the given path is a directory, 1 if the path is a
501+
// file, or 0 if no such path exists.
501502
const FILE_STATUS_DIR: u32 = 3;
502503

503504
run_path_with_cstr(p, &|c_path| {

library/std/src/sys/stdio/vexos.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl io::Write for Stdout {
5757
}
5858
.try_into()
5959
.map_err(|_| {
60-
io::const_error!(io::ErrorKind::Uncategorized, "Internal write error occurred.")
60+
io::const_error!(io::ErrorKind::Uncategorized, "internal write error occurred")
6161
})?;
6262

6363
written += count;

0 commit comments

Comments
 (0)