echoes 0.12.0

Find duplicated Rust doctests, functions and contexts
Documentation
[
  {
    "id": "ca_vec",
    "family": "constructor_annotations",
    "a": "fn f() -> (usize, usize) { let mut v: Vec<u32> = Vec::new(); v.push(1); (v.len(), v.capacity()) } fn main(){ println!(\"{:?}\", f()); }",
    "b": "fn f() -> (usize, usize) { let mut v = Vec::<u32>::new(); v.push(1); (v.len(), v.capacity()) } fn main(){ println!(\"{:?}\", f()); }",
    "expected": "same",
    "expect": {
      "a": {
        "off": {
          "compile": "ok",
          "run": "value",
          "stdout": "(1, 4)\n"
        },
        "on": {
          "compile": "ok",
          "run": "value",
          "stdout": "(1, 4)\n"
        }
      },
      "b": {
        "off": {
          "compile": "ok",
          "run": "value",
          "stdout": "(1, 4)\n"
        },
        "on": {
          "compile": "ok",
          "run": "value",
          "stdout": "(1, 4)\n"
        }
      }
    }
  },
  {
    "id": "ca_capacity",
    "family": "constructor_annotations",
    "a": "fn f() -> usize { let s: String = String::with_capacity(9); s.capacity() } fn main(){ println!(\"{}\", f()); }",
    "b": "fn f() -> usize { let s = String::with_capacity(9); s.capacity() } fn main(){ println!(\"{}\", f()); }",
    "expected": "same",
    "expect": {
      "a": {
        "off": {
          "compile": "ok",
          "run": "value",
          "stdout": "9\n"
        },
        "on": {
          "compile": "ok",
          "run": "value",
          "stdout": "9\n"
        }
      },
      "b": {
        "off": {
          "compile": "ok",
          "run": "value",
          "stdout": "9\n"
        },
        "on": {
          "compile": "ok",
          "run": "value",
          "stdout": "9\n"
        }
      }
    }
  },
  {
    "id": "ca_hashmap",
    "family": "constructor_annotations",
    "a": "use std::collections::HashMap; fn f() -> usize { let mut m: HashMap<u32, u8> = HashMap::with_capacity(3); m.insert(1, 2); m.len() + usize::from(m.capacity() >= 3) } fn main(){ println!(\"{}\", f()); }",
    "b": "use std::collections::HashMap; fn f() -> usize { let mut m = HashMap::<u32, u8>::with_capacity(3); m.insert(1, 2); m.len() + usize::from(m.capacity() >= 3) } fn main(){ println!(\"{}\", f()); }",
    "expected": "same",
    "expect": {
      "a": {
        "off": {
          "compile": "ok",
          "run": "value",
          "stdout": "2\n"
        },
        "on": {
          "compile": "ok",
          "run": "value",
          "stdout": "2\n"
        }
      },
      "b": {
        "off": {
          "compile": "ok",
          "run": "value",
          "stdout": "2\n"
        },
        "on": {
          "compile": "ok",
          "run": "value",
          "stdout": "2\n"
        }
      }
    }
  },
  {
    "id": "ca_btree",
    "family": "constructor_annotations",
    "a": "fn f() -> Vec<u32> { let mut s: std::collections::BTreeSet<u32> = std::collections::BTreeSet::new(); s.insert(3); s.insert(1); s.into_iter().collect() } fn main(){ println!(\"{:?}\", f()); }",
    "b": "fn f() -> Vec<u32> { let mut s = std::collections::BTreeSet::<u32>::new(); s.insert(3); s.insert(1); s.into_iter().collect() } fn main(){ println!(\"{:?}\", f()); }",
    "expected": "same",
    "expect": {
      "a": {
        "off": {
          "compile": "ok",
          "run": "value",
          "stdout": "[1, 3]\n"
        },
        "on": {
          "compile": "ok",
          "run": "value",
          "stdout": "[1, 3]\n"
        }
      },
      "b": {
        "off": {
          "compile": "ok",
          "run": "value",
          "stdout": "[1, 3]\n"
        },
        "on": {
          "compile": "ok",
          "run": "value",
          "stdout": "[1, 3]\n"
        }
      }
    }
  },
  {
    "id": "ca_prim",
    "family": "constructor_annotations",
    "a": "fn f(x: u32) -> u32 { let y: u32 = x; y.wrapping_add(1) } fn main(){ println!(\"{}\", f(u32::MAX)); }",
    "b": "fn f(x: u32) -> u32 { let y = x; y.wrapping_add(1) } fn main(){ println!(\"{}\", f(u32::MAX)); }",
    "expected": "same",
    "expect": {
      "a": {
        "off": {
          "compile": "ok",
          "run": "value",
          "stdout": "0\n"
        },
        "on": {
          "compile": "ok",
          "run": "value",
          "stdout": "0\n"
        }
      },
      "b": {
        "off": {
          "compile": "ok",
          "run": "value",
          "stdout": "0\n"
        },
        "on": {
          "compile": "ok",
          "run": "value",
          "stdout": "0\n"
        }
      }
    }
  },
  {
    "id": "ca_char",
    "family": "constructor_annotations",
    "a": "fn f(c: char) -> bool { let d: char = c; d == 'a' } fn main(){ println!(\"{} {}\", f('a'), f('b')); }",
    "b": "fn f(c: char) -> bool { let d = c; d == 'a' } fn main(){ println!(\"{} {}\", f('a'), f('b')); }",
    "expected": "same",
    "expect": {
      "a": {
        "off": {
          "compile": "ok",
          "run": "value",
          "stdout": "true false\n"
        },
        "on": {
          "compile": "ok",
          "run": "value",
          "stdout": "true false\n"
        }
      },
      "b": {
        "off": {
          "compile": "ok",
          "run": "value",
          "stdout": "true false\n"
        },
        "on": {
          "compile": "ok",
          "run": "value",
          "stdout": "true false\n"
        }
      }
    }
  },
  {
    "id": "ca_coerce",
    "family": "constructor_annotations",
    "a": "fn f() -> usize { let v: Vec<u32> = Vec::with_capacity(5); v.capacity() } fn main(){ println!(\"{}\", f()); }",
    "b": "fn f() -> usize { let v: Vec<u32> = Vec::new(); v.capacity() } fn main(){ println!(\"{}\", f()); }",
    "expected": "different",
    "expect": {
      "a": {
        "off": {
          "compile": "ok",
          "run": "value",
          "stdout": "5\n"
        },
        "on": {
          "compile": "ok",
          "run": "value",
          "stdout": "5\n"
        }
      },
      "b": {
        "off": {
          "compile": "ok",
          "run": "value",
          "stdout": "0\n"
        },
        "on": {
          "compile": "ok",
          "run": "value",
          "stdout": "0\n"
        }
      }
    }
  }
]