updates, clippy, formatting master
authorTim "tim3z" Zeitz <dev@tim3z.net>
Thu, 16 Dec 2021 09:47:11 +0000 (10:47 +0100)
committerTim "tim3z" Zeitz <dev@tim3z.net>
Thu, 16 Dec 2021 09:47:11 +0000 (10:47 +0100)
Cargo.lock
Cargo.toml
src/bin/example.rs
src/index_heap.rs
src/io.rs

index 2d33e1db34d25559650e5f38acf112c7f88d2325..b98a97af9fe86b83741d7eb803e6197a7c051b3e 100644 (file)
@@ -1,53 +1,7 @@
 # This file is automatically @generated by Cargo.
 # It is not intended for manual editing.
-[[package]]
-name = "libc"
-version = "0.2.80"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
+version = 3
 
 [[package]]
 name = "stud-rust-base"
 version = "0.1.0"
-dependencies = [
- "time",
-]
-
-[[package]]
-name = "time"
-version = "0.1.44"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
-dependencies = [
- "libc",
- "wasi",
- "winapi",
-]
-
-[[package]]
-name = "wasi"
-version = "0.10.0+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
-
-[[package]]
-name = "winapi"
-version = "0.3.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
-dependencies = [
- "winapi-i686-pc-windows-gnu",
- "winapi-x86_64-pc-windows-gnu",
-]
-
-[[package]]
-name = "winapi-i686-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-
-[[package]]
-name = "winapi-x86_64-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
index 344beb8b2cde2e8154d5e891b10481ffc5a22025..42ddd252d4bddd132747c2bd269c197fc556bef8 100644 (file)
@@ -2,7 +2,4 @@
 name = "stud-rust-base"
 version = "0.1.0"
 authors = ["Tim Zeitz <tim.zeitz@kit.edu>"]
-edition = '2018'
-
-[dependencies]
-time = "^0.1.40"
+edition = '2021'
index 667bff3933bf0c34658a6be642cf535e9933a067..e1eb51f5362223956d84d3ddee8d86ef6c51d088 100644 (file)
@@ -3,7 +3,7 @@ use stud_rust_base::{io::*, time::report_time, types::*};
 use std::{env, error::Error, path::Path};
 
 fn main() -> Result<(), Box<dyn Error>> {
-    let arg = &env::args().skip(1).next().expect("No directory arg given");
+    let arg = &env::args().nth(1).expect("No directory arg given");
     let path = Path::new(arg);
 
     let first_out = Vec::<EdgeId>::load_from(path.join("first_out"))?;
index 5850ae802a3005775e593a86e1d6091931421d18..2c6f61397984a7719e9d3156440d3ea28adbee7a 100644 (file)
@@ -168,10 +168,7 @@ impl<T: Ord + Indexing> IndexdMinHeap<T> {
             let mut hole = Hole::new(&mut self.data, position);
 
             loop {
-                if let Some(smallest_child) =
-                    IndexdMinHeap::<T>::children_index_range(position, heap_size)
-                        .min_by_key(|&child_index| hole.get(child_index))
-                {
+                if let Some(smallest_child) = IndexdMinHeap::<T>::children_index_range(position, heap_size).min_by_key(|&child_index| hole.get(child_index)) {
                     if hole.get(smallest_child) >= hole.element() {
                         self.positions[hole.element().as_index()] = position;
                         return; // no child is smaller
@@ -218,11 +215,7 @@ impl<'a, T> Hole<'a, T> {
     unsafe fn new(data: &'a mut [T], pos: usize) -> Self {
         debug_assert!(pos < data.len());
         let elt = ptr::read(&data[pos]);
-        Hole {
-            data,
-            elt: Some(elt),
-            pos,
-        }
+        Hole { data, elt: Some(elt), pos }
     }
 
     /// Returns a reference to the element removed.
index 52057af8249cca0afaa063a52e8e2269bb34a01d..3c4d73276be9e703cc68245f50e37cddb695bf57 100644 (file)
--- a/src/io.rs
+++ b/src/io.rs
@@ -51,7 +51,7 @@ impl<T: Copy> DataBytes for [T] {
 
 impl<T: Copy> DataBytes for Vec<T> {
     fn data_bytes(&self) -> &[u8] {
-        &self[..].data_bytes()
+        self[..].data_bytes()
     }
 }