libstd: deny(elided_lifetimes_in_paths), fixes in wasi
This commit is contained in:
parent
6f4df8c0c2
commit
c5d60910ca
@ -23,25 +23,25 @@ pub type RiFlags = u16;
|
||||
pub type RoFlags = u16;
|
||||
pub type SiFlags = u16;
|
||||
|
||||
fn iovec(a: &mut [IoVecMut]) -> (*const libc::__wasi_iovec_t, usize) {
|
||||
fn iovec(a: &mut [IoVecMut<'_>]) -> (*const libc::__wasi_iovec_t, usize) {
|
||||
assert_eq!(
|
||||
mem::size_of::<IoVecMut>(),
|
||||
mem::size_of::<IoVecMut<'_>>(),
|
||||
mem::size_of::<libc::__wasi_iovec_t>()
|
||||
);
|
||||
assert_eq!(
|
||||
mem::align_of::<IoVecMut>(),
|
||||
mem::align_of::<IoVecMut<'_>>(),
|
||||
mem::align_of::<libc::__wasi_iovec_t>()
|
||||
);
|
||||
(a.as_ptr() as *const libc::__wasi_iovec_t, a.len())
|
||||
}
|
||||
|
||||
fn ciovec(a: &[IoVec]) -> (*const libc::__wasi_ciovec_t, usize) {
|
||||
fn ciovec(a: &[IoVec<'_>]) -> (*const libc::__wasi_ciovec_t, usize) {
|
||||
assert_eq!(
|
||||
mem::size_of::<IoVec>(),
|
||||
mem::size_of::<IoVec<'_>>(),
|
||||
mem::size_of::<libc::__wasi_ciovec_t>()
|
||||
);
|
||||
assert_eq!(
|
||||
mem::align_of::<IoVec>(),
|
||||
mem::align_of::<IoVec<'_>>(),
|
||||
mem::align_of::<libc::__wasi_ciovec_t>()
|
||||
);
|
||||
(a.as_ptr() as *const libc::__wasi_ciovec_t, a.len())
|
||||
@ -56,28 +56,28 @@ impl WasiFd {
|
||||
cvt_wasi(unsafe { libc::__wasi_fd_datasync(self.fd) })
|
||||
}
|
||||
|
||||
pub fn pread(&self, bufs: &mut [IoVecMut], offset: u64) -> io::Result<usize> {
|
||||
pub fn pread(&self, bufs: &mut [IoVecMut<'_>], offset: u64) -> io::Result<usize> {
|
||||
let mut read = 0;
|
||||
let (ptr, len) = iovec(bufs);
|
||||
cvt_wasi(unsafe { libc::__wasi_fd_pread(self.fd, ptr, len, offset, &mut read) })?;
|
||||
Ok(read)
|
||||
}
|
||||
|
||||
pub fn pwrite(&self, bufs: &[IoVec], offset: u64) -> io::Result<usize> {
|
||||
pub fn pwrite(&self, bufs: &[IoVec<'_>], offset: u64) -> io::Result<usize> {
|
||||
let mut read = 0;
|
||||
let (ptr, len) = ciovec(bufs);
|
||||
cvt_wasi(unsafe { libc::__wasi_fd_pwrite(self.fd, ptr, len, offset, &mut read) })?;
|
||||
Ok(read)
|
||||
}
|
||||
|
||||
pub fn read(&self, bufs: &mut [IoVecMut]) -> io::Result<usize> {
|
||||
pub fn read(&self, bufs: &mut [IoVecMut<'_>]) -> io::Result<usize> {
|
||||
let mut read = 0;
|
||||
let (ptr, len) = iovec(bufs);
|
||||
cvt_wasi(unsafe { libc::__wasi_fd_read(self.fd, ptr, len, &mut read) })?;
|
||||
Ok(read)
|
||||
}
|
||||
|
||||
pub fn write(&self, bufs: &[IoVec]) -> io::Result<usize> {
|
||||
pub fn write(&self, bufs: &[IoVec<'_>]) -> io::Result<usize> {
|
||||
let mut read = 0;
|
||||
let (ptr, len) = ciovec(bufs);
|
||||
cvt_wasi(unsafe { libc::__wasi_fd_write(self.fd, ptr, len, &mut read) })?;
|
||||
@ -281,7 +281,7 @@ impl WasiFd {
|
||||
|
||||
pub fn sock_recv(
|
||||
&self,
|
||||
ri_data: &mut [IoVecMut],
|
||||
ri_data: &mut [IoVecMut<'_>],
|
||||
ri_flags: RiFlags,
|
||||
) -> io::Result<(usize, RoFlags)> {
|
||||
let mut ro_datalen = 0;
|
||||
@ -293,7 +293,7 @@ impl WasiFd {
|
||||
Ok((ro_datalen, ro_flags))
|
||||
}
|
||||
|
||||
pub fn sock_send(&self, si_data: &[IoVec], si_flags: SiFlags) -> io::Result<usize> {
|
||||
pub fn sock_send(&self, si_data: &[IoVec<'_>], si_flags: SiFlags) -> io::Result<usize> {
|
||||
let mut so_datalen = 0;
|
||||
let (ptr, len) = ciovec(si_data);
|
||||
cvt_wasi(unsafe { libc::__wasi_sock_send(self.fd, ptr, len, si_flags, &mut so_datalen) })?;
|
||||
|
@ -82,7 +82,7 @@ impl Eq for FilePermissions {
|
||||
}
|
||||
|
||||
impl fmt::Debug for FilePermissions {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.0 {}
|
||||
}
|
||||
}
|
||||
@ -125,13 +125,13 @@ impl Hash for FileType {
|
||||
}
|
||||
|
||||
impl fmt::Debug for FileType {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.0 {}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for ReadDir {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.0 {}
|
||||
}
|
||||
}
|
||||
@ -236,7 +236,7 @@ impl DirBuilder {
|
||||
}
|
||||
|
||||
impl fmt::Debug for File {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.0 {}
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ impl TcpStream {
|
||||
}
|
||||
|
||||
impl fmt::Debug for TcpStream {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.0 {}
|
||||
}
|
||||
}
|
||||
@ -144,7 +144,7 @@ impl TcpListener {
|
||||
}
|
||||
|
||||
impl fmt::Debug for TcpListener {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.0 {}
|
||||
}
|
||||
}
|
||||
@ -282,7 +282,7 @@ impl UdpSocket {
|
||||
}
|
||||
|
||||
impl fmt::Debug for UdpSocket {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.0 {}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ pub fn chdir(_: &path::Path) -> io::Result<()> {
|
||||
|
||||
pub struct SplitPaths<'a>(&'a Void);
|
||||
|
||||
pub fn split_paths(_unparsed: &OsStr) -> SplitPaths {
|
||||
pub fn split_paths(_unparsed: &OsStr) -> SplitPaths<'_> {
|
||||
panic!("unsupported")
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ pub fn join_paths<I, T>(_paths: I) -> Result<OsString, JoinPathsError>
|
||||
}
|
||||
|
||||
impl fmt::Display for JoinPathsError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
"not supported on wasm yet".fmt(f)
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ pub fn is_verbatim_sep(b: u8) -> bool {
|
||||
b == b'/'
|
||||
}
|
||||
|
||||
pub fn parse_prefix(_: &OsStr) -> Option<Prefix> {
|
||||
pub fn parse_prefix(_: &OsStr) -> Option<Prefix<'_>> {
|
||||
None
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ impl From<File> for Stdio {
|
||||
}
|
||||
|
||||
impl fmt::Debug for Command {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@ -108,13 +108,13 @@ impl Eq for ExitStatus {
|
||||
}
|
||||
|
||||
impl fmt::Debug for ExitStatus {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.0 {}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for ExitStatus {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self.0 {}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user