Fixing warnings with Rust 1.57 + cleanup

pmeunier
Dec 6, 2021, 9:11 AM
KVCXCDRMB6RLPPKI5QYQAGNEQ342OUL37VWN7QKJRCUP2HIVZSAQC

Dependencies

  • [2] FXEDPLRI Resurrecting tests, and type cleanup (no need for Arc<RwLock<…>> anymore)
  • [3] 7WIVT3R7 binary diff creates new chunk when no exact match found
  • [4] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [5] KLBWKCUZ use ssh url syntax like git
  • [6] TGA6QXGI Initial support for binary diffs (conflicts are not yet supported in the output)
  • [7] A3RM526Y Integrating identity malleability
  • [8] VO5OQW4W Removing anyhow in libpijul
  • [9] SZWBLWZ4 Reading ~/.ssh/config
  • [10] KTTKF3RW Locking stderr and the progress bar in SSH
  • [11] H23LO7U7 a few more clippy lints addressed
  • [12] I24UEJQL Various post-fire fixes
  • [13] LV34DUJY Formatting
  • [14] 4DNDMC7I Fixing a number of bugs related to encodings (extra newlines + misdetection in linux2x)

Change contents

  • edit in pijul/src/remote/ssh.rs at line 46
    [4.26241][4.0:19](),[4.19][4.26241:26260](),[4.26241][4.26241:26260]()
    addr: &'a str,
    host: &'a str,
  • replacement in pijul/src/remote/ssh.rs at line 83
    [4.453][4.447:530](),[4.447][4.447:530]()
    Some(Remote {
    addr,
    host,
    path,
    config,
    })
    [4.453]
    [4.27295]
    Some(Remote { path, config })
  • replacement in libpijul/src/working_copy/memory.rs at line 241
    [4.206878][4.2604:2693]()
    fn modified_time(&self, _file: &str) -> Result<std::time::SystemTime, Self::Error> {
    [4.206878]
    [2.392]
    fn modified_time(&self, file: &str) -> Result<std::time::SystemTime, Self::Error> {
  • replacement in libpijul/src/working_copy/memory.rs at line 243
    [2.423][4.26299:26327](),[4.26299][4.26299:26327]()
    Ok(m.last_modified)
    [2.423]
    [4.207000]
    match m.get_file(file) {
    Some(Inode::Directory { last_modified, .. })
    | Some(Inode::File { last_modified, .. }) => Ok(*last_modified),
    _ => Ok(m.last_modified),
    }
  • replacement in libpijul/src/diff/bin.rs at line 60
    [3.110][4.4082:4122](),[4.4082][4.4082:4122]()
    for &(v, old) in v.iter() {
    [3.110]
    [3.111]
    for &(_, old) in v.iter() {
  • edit in libpijul/src/diff/bin.rs at line 67
    [4.4266][4.4266:4302]()
    old_pos: v,
  • edit in libpijul/src/diff/bin.rs at line 126
    [4.5708][4.5708:5732]()
    old_pos: usize,
  • edit in libpijul/src/diff/bin.rs at line 133
    [4.5800][4.5800:9029]()
    /*
    pub fn diff<D: diffs::Diff>(window: usize, a: &[u8], b: &[u8], d: D)
    where
    D::Error: std::fmt::Debug,
    {
    let a_h = make_old_chunks(window, a);
    let bb = make_new_chunks(window, &a_h, b);
    // Make a dummy vector (because `std::ops::Index` wants a borrow).
    let mut aa = Vec::with_capacity(a.len() / window + 1);
    for pos in 0..(a.len() + window - 1) / window {
    aa.push(pos)
    }
    diffs::myers::diff(
    &mut W {
    d,
    window,
    old_len: a.len(),
    a: &aa,
    b: &bb,
    },
    &aa,
    0,
    aa.len(),
    &bb,
    0,
    bb.len(),
    )
    .unwrap();
    }
    impl Chunk {
    fn start(&self) -> usize {
    match *self {
    Chunk::Old { start, .. } => start,
    Chunk::New { start, .. } => start,
    }
    }
    }
    impl PartialEq<usize> for Chunk {
    fn eq(&self, b: &usize) -> bool {
    if let Chunk::Old { old_pos, .. } = *self {
    old_pos == *b
    } else {
    false
    }
    }
    }
    #[derive(Debug)]
    struct W<'a, D> {
    d: D,
    window: usize,
    old_len: usize,
    a: &'a [usize],
    b: &'a [Chunk],
    }
    impl<'a, D: diffs::Diff> diffs::Diff for W<'a, D>
    where
    D::Error: std::fmt::Debug,
    {
    type Error = D::Error;
    fn equal(&mut self, old: usize, new: usize, len: usize) -> Result<(), Self::Error> {
    let old = old * self.window;
    let new = self.b[new].start();
    let len = (len * self.window).min(self.old_len - old);
    self.d.equal(old, new, len)
    }
    fn delete(&mut self, old: usize, len: usize, new: usize) -> Result<(), Self::Error> {
    let old = old * self.window;
    let new = self.b[new].start();
    let len = (len * self.window).min(self.old_len - old);
    self.d.delete(old, len, new)
    }
    fn insert(&mut self, old: usize, new: usize, new_len: usize) -> Result<(), Self::Error> {
    let old = old * self.window;
    let new = self.b[new].start();
    let mut new_len_ = 0;
    for b in &self.b[new .. new + new_len] {
    match b {
    Chunk::Old { start, .. } => {
    new_len_ += self.window.min(self.old_len - start)
    }
    Chunk::New { len, .. } => {
    new_len_ += len
    }
    }
    }
    self.d.insert(old, new, new_len_)
    }
    fn replace(
    &mut self,
    old: usize,
    old_len: usize,
    new: usize,
    new_len: usize,
    ) -> Result<(), Self::Error> {
    let old = old * self.window;
    let old_len = (old_len * self.window).min(self.old_len - old);
    let new = self.b[new].start();
    let mut new_len_ = 0;
    for b in &self.b[new .. new + new_len] {
    match b {
    Chunk::Old { start, .. } => {
    new_len_ += self.window.min(self.old_len - start)
    }
    Chunk::New { len, .. } => {
    new_len_ += len
    }
    }
    }
    self.d.replace(old, old_len, new, new_len_)
    }
    fn finish(&mut self) -> Result<(), Self::Error> {
    self.d.finish()
    }
    }
    */