]> git.lizzy.rs Git - rust.git/commitdiff
clippy
authorRalf Jung <post@ralfj.de>
Sun, 27 Nov 2022 19:50:53 +0000 (20:50 +0100)
committerRalf Jung <post@ralfj.de>
Sun, 27 Nov 2022 19:53:17 +0000 (20:53 +0100)
src/tools/miri/src/helpers.rs
src/tools/miri/src/shims/os_str.rs
src/tools/miri/src/shims/unix/fs.rs
src/tools/miri/src/stacked_borrows/mod.rs

index bf086a7c623300cb8cb37fe4947e46b1d46beb85..f0d8b6768810c720fc7c367d90de6e9ef68c852e 100644 (file)
@@ -76,11 +76,7 @@ impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriInterpCx<'mir,
 /// Gets an instance for a path.
 ///
 /// A `None` namespace indicates we are looking for a module.
-fn try_resolve_did<'tcx>(
-    tcx: TyCtxt<'tcx>,
-    path: &[&str],
-    namespace: Option<Namespace>,
-) -> Option<DefId> {
+fn try_resolve_did(tcx: TyCtxt<'_>, path: &[&str], namespace: Option<Namespace>) -> Option<DefId> {
     /// Yield all children of the given item, that have the given name.
     fn find_children<'tcx: 'a, 'a>(
         tcx: TyCtxt<'tcx>,
index 99b3605c60175458d117488ab67d7bc01f22c5ce..bc7ca82997bb8e05d663fa4f08b162aa3ea39519 100644 (file)
@@ -18,12 +18,12 @@ pub enum PathConversion {
 }
 
 #[cfg(unix)]
-pub fn os_str_to_bytes<'a, 'tcx>(os_str: &'a OsStr) -> InterpResult<'tcx, &'a [u8]> {
+pub fn os_str_to_bytes<'tcx>(os_str: &OsStr) -> InterpResult<'tcx, &[u8]> {
     Ok(os_str.as_bytes())
 }
 
 #[cfg(not(unix))]
-pub fn os_str_to_bytes<'a, 'tcx>(os_str: &'a OsStr) -> InterpResult<'tcx, &'a [u8]> {
+pub fn os_str_to_bytes<'tcx>(os_str: &OsStr) -> InterpResult<'tcx, &[u8]> {
     // On non-unix platforms the best we can do to transform bytes from/to OS strings is to do the
     // intermediate transformation into strings. Which invalidates non-utf8 paths that are actually
     // valid.
@@ -34,11 +34,11 @@ pub fn os_str_to_bytes<'a, 'tcx>(os_str: &'a OsStr) -> InterpResult<'tcx, &'a [u
 }
 
 #[cfg(unix)]
-pub fn bytes_to_os_str<'a, 'tcx>(bytes: &'a [u8]) -> InterpResult<'tcx, &'a OsStr> {
+pub fn bytes_to_os_str<'tcx>(bytes: &[u8]) -> InterpResult<'tcx, &OsStr> {
     Ok(OsStr::from_bytes(bytes))
 }
 #[cfg(not(unix))]
-pub fn bytes_to_os_str<'a, 'tcx>(bytes: &'a [u8]) -> InterpResult<'tcx, &'a OsStr> {
+pub fn bytes_to_os_str<'tcx>(bytes: &[u8]) -> InterpResult<'tcx, &OsStr> {
     let s = std::str::from_utf8(bytes)
         .map_err(|_| err_unsup_format!("{:?} is not a valid utf-8 string", bytes))?;
     Ok(OsStr::new(s))
index 816e7d87e85867cd37dd71e1ebf2d4e7f5437452..e048d53a17e0d498630b698711e830ec60b12ac5 100644 (file)
@@ -1911,8 +1911,8 @@ struct FileMetadata {
 }
 
 impl FileMetadata {
-    fn from_path<'tcx, 'mir>(
-        ecx: &mut MiriInterpCx<'mir, 'tcx>,
+    fn from_path<'tcx>(
+        ecx: &mut MiriInterpCx<'_, 'tcx>,
         path: &Path,
         follow_symlink: bool,
     ) -> InterpResult<'tcx, Option<FileMetadata>> {
@@ -1922,8 +1922,8 @@ fn from_path<'tcx, 'mir>(
         FileMetadata::from_meta(ecx, metadata)
     }
 
-    fn from_fd<'tcx, 'mir>(
-        ecx: &mut MiriInterpCx<'mir, 'tcx>,
+    fn from_fd<'tcx>(
+        ecx: &mut MiriInterpCx<'_, 'tcx>,
         fd: i32,
     ) -> InterpResult<'tcx, Option<FileMetadata>> {
         let option = ecx.machine.file_handler.handles.get(&fd);
@@ -1936,8 +1936,8 @@ fn from_fd<'tcx, 'mir>(
         FileMetadata::from_meta(ecx, metadata)
     }
 
-    fn from_meta<'tcx, 'mir>(
-        ecx: &mut MiriInterpCx<'mir, 'tcx>,
+    fn from_meta<'tcx>(
+        ecx: &mut MiriInterpCx<'_, 'tcx>,
         metadata: Result<std::fs::Metadata, std::io::Error>,
     ) -> InterpResult<'tcx, Option<FileMetadata>> {
         let metadata = match metadata {
index f6f5c063b39e85aef811089ab08683e884921ba8..4e369f4291a3f821c4315e32afe387f0352fb52c 100644 (file)
@@ -663,12 +663,12 @@ pub fn before_memory_read<'tcx, 'mir, 'ecx>(
     }
 
     #[inline(always)]
-    pub fn before_memory_write<'tcx, 'mir, 'ecx>(
+    pub fn before_memory_write<'tcx>(
         &mut self,
         alloc_id: AllocId,
         tag: ProvenanceExtra,
         range: AllocRange,
-        machine: &'ecx mut MiriMachine<'mir, 'tcx>,
+        machine: &mut MiriMachine<'_, 'tcx>,
     ) -> InterpResult<'tcx> {
         trace!(
             "write access with tag {:?}: {:?}, size {}",
@@ -684,12 +684,12 @@ pub fn before_memory_write<'tcx, 'mir, 'ecx>(
     }
 
     #[inline(always)]
-    pub fn before_memory_deallocation<'tcx, 'mir, 'ecx>(
+    pub fn before_memory_deallocation<'tcx>(
         &mut self,
         alloc_id: AllocId,
         tag: ProvenanceExtra,
         range: AllocRange,
-        machine: &'ecx mut MiriMachine<'mir, 'tcx>,
+        machine: &mut MiriMachine<'_, 'tcx>,
     ) -> InterpResult<'tcx> {
         trace!("deallocation with tag {:?}: {:?}, size {}", tag, alloc_id, range.size.bytes());
         let dcx = DiagnosticCxBuilder::dealloc(machine, tag);