Skip to content

Commit d985e75

Browse files
committed
wasi: fix warnings
1 parent 8dd5f8f commit d985e75

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/uu/wc/src/countable.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pub trait WordCountable: AsFd + AsRawFd + Read {
2424
pub trait WordCountable: Read {
2525
type Buffered: BufRead;
2626
fn buffered(self) -> Self::Buffered;
27+
#[cfg(not(target_os = "wasi"))]
2728
fn inner_file(&mut self) -> Option<&mut File>;
2829
}
2930

@@ -33,6 +34,8 @@ impl WordCountable for StdinLock<'_> {
3334
fn buffered(self) -> Self::Buffered {
3435
self
3536
}
37+
38+
#[cfg(not(target_os = "wasi"))]
3639
fn inner_file(&mut self) -> Option<&mut File> {
3740
None
3841
}
@@ -45,6 +48,7 @@ impl WordCountable for File {
4548
BufReader::new(self)
4649
}
4750

51+
#[cfg(not(target_os = "wasi"))]
4852
fn inner_file(&mut self) -> Option<&mut File> {
4953
Some(self)
5054
}

src/uucore/src/lib/features/fs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub struct FileInformation(
4646
#[cfg(unix)] nix::sys::stat::FileStat,
4747
#[cfg(windows)] winapi_util::file::Information,
4848
// WASI does not have nix::sys::stat, so we store std::fs::Metadata instead.
49-
#[cfg(target_os = "wasi")] std::fs::Metadata,
49+
#[cfg(target_os = "wasi")] fs::Metadata,
5050
);
5151

5252
impl FileInformation {
@@ -97,9 +97,9 @@ impl FileInformation {
9797
#[cfg(target_os = "wasi")]
9898
{
9999
let metadata = if dereference {
100-
std::fs::metadata(path.as_ref())
100+
fs::metadata(path.as_ref())
101101
} else {
102-
std::fs::symlink_metadata(path.as_ref())
102+
fs::symlink_metadata(path.as_ref())
103103
};
104104
Ok(Self(metadata?))
105105
}

src/uucore/src/lib/features/fsext.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use crate::os_str_from_bytes;
2828
#[cfg(windows)]
2929
use crate::show_warning;
3030

31+
#[cfg(not(target_os = "wasi"))]
3132
use std::ffi::OsStr;
3233
#[cfg(unix)]
3334
use std::os::unix::ffi::OsStrExt;
@@ -64,13 +65,14 @@ use libc::{
6465
};
6566
#[cfg(unix)]
6667
use std::ffi::{CStr, CString};
68+
#[cfg(not(target_os = "wasi"))]
6769
use std::io::Error as IOError;
6870
#[cfg(unix)]
6971
use std::mem;
7072
#[cfg(windows)]
7173
use std::path::Path;
7274
use std::time::SystemTime;
73-
#[cfg(not(windows))]
75+
#[cfg(unix)]
7476
use std::time::UNIX_EPOCH;
7577
use std::{borrow::Cow, ffi::OsString};
7678

0 commit comments

Comments
 (0)