diff --git a/src/commands/build.rs b/src/commands/build.rs index 46bca724..41cc135f 100644 --- a/src/commands/build.rs +++ b/src/commands/build.rs @@ -157,7 +157,7 @@ pub async fn build( )); } let package = *packages - .get(0) + .first() .ok_or_else(|| anyhow!("Found no package."))?; let release_stores = config diff --git a/src/commands/endpoint_container.rs b/src/commands/endpoint_container.rs index b7c6882e..0e102a45 100644 --- a/src/commands/endpoint_container.rs +++ b/src/commands/endpoint_container.rs @@ -52,7 +52,7 @@ pub async fn container( } let relevant_endpoint = relevant_endpoints - .get(0) + .first() .ok_or_else(|| anyhow!("Found no container for id {}", container_id))?; let container = relevant_endpoint diff --git a/src/package/dependency/build.rs b/src/package/dependency/build.rs index 678c5646..ad2440eb 100644 --- a/src/package/dependency/build.rs +++ b/src/package/dependency/build.rs @@ -128,7 +128,7 @@ mod tests { let s: TestSettings = toml::from_str(r#"settings = [{ name = "foo", condition = { in_image = "bar"} }]"#) .expect("Parsing TestSetting failed"); - match s.settings.get(0).expect("Has not one dependency") { + match s.settings.first().expect("Has not one dependency") { BuildDependency::Conditional { name, condition } => { assert_eq!(name, "foo", "Expected 'foo', got {name}"); assert_eq!(*condition.has_env(), None); @@ -152,7 +152,7 @@ mod tests { let s: TestSettings = toml::from_str(pretty).expect("Parsing TestSetting failed"); - match s.settings.get(0).expect("Has not one dependency") { + match s.settings.first().expect("Has not one dependency") { BuildDependency::Conditional { name, condition } => { assert_eq!(name, "foo", "Expected 'foo', got {name}"); assert_eq!(*condition.has_env(), None); @@ -176,7 +176,7 @@ mod tests { let s: TestSettings = toml::from_str(pretty).expect("Parsing TestSetting failed"); - match s.settings.get(0).expect("Has not one dependency") { + match s.settings.first().expect("Has not one dependency") { BuildDependency::Conditional { name, condition } => { assert_eq!(name, "foo", "Expected 'foo', got {name}"); assert_eq!(*condition.has_env(), None); diff --git a/src/package/dependency/runtime.rs b/src/package/dependency/runtime.rs index f077e57f..75708acb 100644 --- a/src/package/dependency/runtime.rs +++ b/src/package/dependency/runtime.rs @@ -142,7 +142,7 @@ mod tests { let s: TestSettings = toml::from_str(r#"settings = [{ name = "foo", condition = { in_image = "bar"} }]"#) .expect("Parsing TestSetting failed"); - match s.settings.get(0).expect("Has not one dependency") { + match s.settings.first().expect("Has not one dependency") { Dependency::Conditional { name, condition } => { assert_eq!(name, "foo", "Expected 'foo', got {name}"); assert_eq!(*condition.has_env(), None); @@ -166,7 +166,7 @@ mod tests { let s: TestSettings = toml::from_str(pretty).expect("Parsing TestSetting failed"); - match s.settings.get(0).expect("Has not one dependency") { + match s.settings.first().expect("Has not one dependency") { Dependency::Conditional { name, condition } => { assert_eq!(name, "foo", "Expected 'foo', got {name}"); assert_eq!(*condition.has_env(), None); @@ -190,7 +190,7 @@ mod tests { let s: TestSettings = toml::from_str(pretty).expect("Parsing TestSetting failed"); - match s.settings.get(0).expect("Has not one dependency") { + match s.settings.first().expect("Has not one dependency") { Dependency::Conditional { name, condition } => { assert_eq!(name, "foo", "Expected 'foo', got {name}"); assert_eq!(*condition.has_env(), None); @@ -218,7 +218,7 @@ mod tests { let s: TestSettings = toml::from_str(pretty).expect("Parsing TestSetting failed"); - match s.settings.get(0).expect("Has not one dependencies") { + match s.settings.first().expect("Has not one dependencies") { Dependency::Conditional { name, condition } => { assert_eq!(name, "foo", "Expected 'foo', got {name}"); assert_eq!(*condition.has_env(), None); diff --git a/src/repository/repository.rs b/src/repository/repository.rs index 87294ade..208ba262 100644 --- a/src/repository/repository.rs +++ b/src/repository/repository.rs @@ -205,7 +205,7 @@ pub mod tests { let ps = repo.find_by_name(&pname("a")); assert_eq!(ps.len(), 1); - let p = ps.get(0).unwrap(); + let p = ps.first().unwrap(); assert_eq!(*p.name(), pname("a")); assert_eq!(*p.version(), pversion("1")); assert!(!p.version_is_semver()); @@ -233,7 +233,7 @@ pub mod tests { let ps = repo.find(&pname("a"), &pversion("2")); assert_eq!(ps.len(), 1); - let p = ps.get(0).unwrap(); + let p = ps.first().unwrap(); assert_eq!(*p.name(), pname("a")); assert_eq!(*p.version(), pversion("2")); assert!(!p.version_is_semver()); @@ -269,7 +269,7 @@ pub mod tests { let ps = repo.find_with_version(&pname("a"), &constraint); assert_eq!(ps.len(), 1); - let p = ps.get(0).unwrap(); + let p = ps.first().unwrap(); assert_eq!(*p.name(), pname("a")); assert_eq!(*p.version(), pversion("2")); assert!(!p.version_is_semver()); diff --git a/src/util/filters.rs b/src/util/filters.rs index 7002b896..dca693ee 100644 --- a/src/util/filters.rs +++ b/src/util/filters.rs @@ -191,7 +191,7 @@ mod tests { .unwrap(); assert_eq!(found.len(), 1); - let p = found.get(0).unwrap(); + let p = found.first().unwrap(); assert_eq!(*p.name(), pname("a")); assert_eq!( *p.dependencies().runtime(), @@ -289,7 +289,7 @@ mod tests { .unwrap(); assert_eq!(found.len(), 1); - let p = found.get(0).unwrap(); + let p = found.first().unwrap(); assert_eq!(*p.name(), pname("a")); assert_eq!( *p.dependencies().runtime(), @@ -346,7 +346,7 @@ mod tests { assert_eq!(found.len(), 2); { - let p = found.get(0).unwrap(); + let p = found.first().unwrap(); assert_eq!(*p.name(), pname("a")); assert_eq!( *p.dependencies().runtime(),