Skip to content

Commit 528a8af

Browse files
committed
Bump `enum-iterator' to 1.2.0. Cleanup some
lints
1 parent fbdd186 commit 528a8af

File tree

4 files changed

+17
-21
lines changed

4 files changed

+17
-21
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ local_offset = ["time/local-offset"]
2828
[dependencies]
2929
anyhow = "1.0.60"
3030
cfg-if = "1.0.0"
31-
enum-iterator = "~1.1.3"
31+
enum-iterator = "1.2.0"
3232
getset = "0.1.2"
3333
git2 = { version = "0.15.0", optional = true, default-features = false }
3434
rustc_version = { version = "0.4.0", optional = true }

src/error.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -71,32 +71,32 @@ mod test {
7171
let err: Error = io::Error::new(ErrorKind::Other, "testing").into();
7272
assert_eq!(
7373
"protocol: There was an error writing the cargo instructions to stdout: testing",
74-
format!("{}", err)
74+
format!("{err}")
7575
);
7676
}
7777

7878
#[cfg(feature = "rustc")]
7979
#[test]
8080
fn rustc_version_error() {
81-
let res = version_meta_for("yoda").map_err(|e| Error::from(e));
81+
let res = version_meta_for("yoda").map_err(Error::from);
8282
assert!(res.is_err());
8383
let err = res.err().unwrap();
8484
assert_eq!(
8585
"protocol: An error occurred in the \'rustc_version\' library: unexpected `rustc -vV` format",
86-
format!("{}", err)
86+
format!("{err}")
8787
);
8888
}
8989

9090
#[cfg(feature = "git")]
9191
#[test]
9292
fn git2_error() {
93-
let res = Repository::open("blah").map_err(|e| Error::from(e));
93+
let res = Repository::open("blah").map_err(Error::from);
9494
assert!(res.is_err());
9595
let err = res.err().unwrap();
9696
#[cfg(target_family = "unix")]
97-
assert_eq!("protocol: An error occurred in the \'git2\' library: failed to resolve path \'blah\': No such file or directory; class=Os (2); code=NotFound (-3)", format!("{}", err));
97+
assert_eq!("protocol: An error occurred in the \'git2\' library: failed to resolve path \'blah\': No such file or directory; class=Os (2); code=NotFound (-3)", format!("{err}"));
9898
#[cfg(target_family = "windows")]
99-
assert_eq!("protocol: An error occurred in the \'git2\' library: failed to resolve path \'blah\': The system cannot find the file specified.\r\n; class=Os (2); code=NotFound (-3)", format!("{}", err));
99+
assert_eq!("protocol: An error occurred in the \'git2\' library: failed to resolve path \'blah\': The system cannot find the file specified.\r\n; class=Os (2); code=NotFound (-3)", format!("{err}"));
100100
}
101101

102102
#[cfg(all(feature = "si", not(target_os = "macos")))]
@@ -105,18 +105,18 @@ mod test {
105105
let err: Error = Error::Pid { msg: "test" };
106106
assert_eq!(
107107
"protocol: Unable to determine the current process pid: test",
108-
format!("{}", err)
108+
format!("{err}")
109109
);
110110
}
111111

112112
#[test]
113113
fn var_error() {
114-
let res = env::var("yoda").map_err(|e| Error::from(e));
114+
let res = env::var("yoda").map_err(Error::from);
115115
assert!(res.is_err());
116116
let err = res.err().unwrap();
117117
assert_eq!(
118118
"env: The \'CARGO_PKG_VERSION\' environment variable may not be set: environment variable not found",
119-
format!("{}", err)
119+
format!("{err}")
120120
);
121121
}
122122
}

src/feature/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ mod test {
9999
#[test]
100100
fn check_add_entry() {
101101
let mut hm = BTreeMap::new();
102-
add_entry(&mut hm, VergenKey::BuildTimestamp, Some("".to_string()));
102+
add_entry(&mut hm, VergenKey::BuildTimestamp, Some(String::new()));
103103
assert!(hm.get(&VergenKey::BuildTimestamp).is_some());
104104
}
105105
}

src/gen.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -377,43 +377,40 @@ mod test {
377377
}
378378

379379
#[test]
380-
fn describe_falls_back() -> Result<()> {
380+
fn describe_falls_back() {
381381
let no_tags_path = PathBuf::from("testdata").join("notagsrepo");
382382
assert!(config_from_instructions(
383383
Instructions::default(),
384384
Some(no_tags_path),
385385
&mut io::sink(),
386386
)
387387
.is_ok());
388-
Ok(())
389388
}
390389

391390
#[test]
392-
fn describe() -> Result<()> {
391+
fn describe() {
393392
let no_tags_path = PathBuf::from("testdata").join("tagsrepo");
394393
assert!(config_from_instructions(
395394
Instructions::default(),
396395
Some(no_tags_path),
397396
&mut io::sink(),
398397
)
399398
.is_ok());
400-
Ok(())
401399
}
402400

403401
#[test]
404-
fn detached_head() -> Result<()> {
402+
fn detached_head() {
405403
let dh_path = PathBuf::from("testdata").join("detachedhead");
406404
assert!(
407405
config_from_instructions(Instructions::default(), Some(dh_path), &mut io::sink(),)
408406
.is_ok()
409407
);
410-
Ok(())
411408
}
412409

413410
// TODO: Make this a macro to check all toggles
414411
#[test]
415412
#[cfg(feature = "build")]
416-
fn toggle_works() -> Result<()> {
413+
fn toggle_works() {
417414
use crate::TimestampKind;
418415
let repo_path = PathBuf::from(".");
419416
let mut config = Instructions::default();
@@ -423,7 +420,6 @@ mod test {
423420
assert!(config_from_instructions(config, Some(repo_path), &mut stdout_buf).is_ok());
424421
let stdout = String::from_utf8_lossy(&stdout_buf);
425422
assert!(!VBD_REGEX.is_match(&stdout));
426-
Ok(())
427423
}
428424

429425
#[cfg(all(
@@ -581,12 +577,12 @@ mod test {
581577

582578
#[cfg(feature = "rustc")]
583579
fn check_rustc_output(stdout: &[u8]) {
584-
assert!(RUSTC_REGEX.is_match(&String::from_utf8_lossy(&stdout)));
580+
assert!(RUSTC_REGEX.is_match(&String::from_utf8_lossy(stdout)));
585581
}
586582

587583
#[cfg(feature = "rustc")]
588584
fn check_no_rustc_output(stdout: &[u8]) {
589-
assert!(!RUSTC_REGEX.is_match(&String::from_utf8_lossy(&stdout)));
585+
assert!(!RUSTC_REGEX.is_match(&String::from_utf8_lossy(stdout)));
590586
}
591587

592588
#[cfg(all(feature = "build", feature = "local_offset"))]

0 commit comments

Comments
 (0)