diff --git a/cargo/src/build/mod.rs b/cargo/src/build/mod.rs index b8ef6200..0ff11a95 100644 --- a/cargo/src/build/mod.rs +++ b/cargo/src/build/mod.rs @@ -38,7 +38,6 @@ use crate::utils::cargo::CompileKindExt; use crate::utils::path::AsRelativeTo; use crate::utils::workspace::PossibleTargets; -use crate::utils::cargo::build_plan as plan; pub mod rustflags; diff --git a/support/build/src/metadata/format.rs b/support/build/src/metadata/format.rs index b27eefd8..b1b3f662 100644 --- a/support/build/src/metadata/format.rs +++ b/support/build/src/metadata/format.rs @@ -53,8 +53,8 @@ impl MetadataSource for Metadata { fn manifest(&self) -> impl ManifestSourceOptExt { &self.inner.manifest } - fn bins<'t>(&'t self) -> &'t [Self::TargetManifest] { self.inner.bins.as_slice() } - fn examples<'t>(&'t self) -> &'t [Self::TargetManifest] { self.inner.examples.as_slice() } + fn bins(&self) -> &[Self::TargetManifest] { self.inner.bins.as_slice() } + fn examples(&self) -> &[Self::TargetManifest] { self.inner.examples.as_slice() } fn bin_targets(&self) -> impl IntoIterator { self.inner.bins.iter().map(|o| o.target.as_str()) } fn example_targets(&self) -> impl IntoIterator { @@ -202,7 +202,7 @@ impl<'t, S> Cob<'t> for Manifest where S: Cob<'t> { launch_sound_path: self.launch_sound_path.as_ref().map(Cob::as_borrow), content_warning: self.content_warning.as_ref().map(Cob::as_borrow), content_warning2: self.content_warning2.as_ref().map(Cob::as_borrow), - build_number: self.build_number.clone() } + build_number: self.build_number } } } @@ -241,7 +241,7 @@ impl IntoOwned::Owned>> for Manifest> { launch_sound_path: self.launch_sound_path.map(|s| s.into_owned()), content_warning: self.content_warning.map(|s| s.into_owned()), content_warning2: self.content_warning2.map(|s| s.into_owned()), - build_number: self.build_number.clone() } + build_number: self.build_number } } } @@ -256,7 +256,7 @@ impl Manifest where S: ToOwned { launch_sound_path: self.launch_sound_path.map(|s| s.to_owned()), content_warning: self.content_warning.map(|s| s.to_owned()), content_warning2: self.content_warning2.map(|s| s.to_owned()), - build_number: self.build_number.clone() } + build_number: self.build_number } } } @@ -373,7 +373,7 @@ impl std::fmt::Display for ExtraValue { } impl From for ExtraValue { - fn from(value: bool) -> Self { Self::Boolean(value.into()) } + fn from(value: bool) -> Self { Self::Boolean(value) } } impl From for ExtraValue { fn from(value: i64) -> Self { Self::Int(value) } @@ -417,7 +417,7 @@ impl ManifestSourceOpt for Manifest where S: Deref { fn launch_sound_path(&self) -> Option<&str> { self.launch_sound_path.as_deref() } fn content_warning(&self) -> Option<&str> { self.content_warning.as_deref() } fn content_warning2(&self) -> Option<&str> { self.content_warning2.as_deref() } - fn build_number(&self) -> Option { self.build_number.clone() } + fn build_number(&self) -> Option { self.build_number } } impl ManifestSourceOpt for Ext { @@ -483,7 +483,7 @@ impl<'s, T: ManifestSourceOpt, S: From<&'s str>> From<&'s T> for Manifest { launch_sound_path: source.launch_sound_path().map(Into::into), content_warning: source.content_warning().map(Into::into), content_warning2: source.content_warning2().map(Into::into), - build_number: source.build_number().clone() } + build_number: source.build_number() } } } @@ -870,7 +870,7 @@ mod tests { #[test] fn options_assets_deps() { // default is false - assert_eq!(false, AssetsOptions::default_dependencies()); + assert!(!AssetsOptions::default_dependencies()); let src = r#" [assets] "#; let m = toml::from_str::(src).unwrap(); assert_matches!( diff --git a/support/build/src/metadata/source.rs b/support/build/src/metadata/source.rs index 12345fea..58ced4a4 100644 --- a/support/build/src/metadata/source.rs +++ b/support/build/src/metadata/source.rs @@ -71,14 +71,12 @@ pub trait CrateInfoSource { log::debug!("target not found: {}", target); None } - } else { - if let Some(man) = root.bin(target) { - Some(base.override_with_extra(man).into_owned()) - } else { - log::debug!("target not found: {}", target); - None - } - } + } else if let Some(man) = root.bin(target) { + Some(base.override_with_extra(man).into_owned()) + } else { + log::debug!("target not found: {}", target); + None + } } else { Some(base.into_owned()) } @@ -98,14 +96,14 @@ pub trait MetadataSource { fn manifest(&self) -> impl ManifestSourceOptExt; - fn bins<'t>(&'t self) -> &'t [Self::TargetManifest]; - fn examples<'t>(&'t self) -> &'t [Self::TargetManifest]; + fn bins(&self) -> &[Self::TargetManifest]; + fn examples(&self) -> &[Self::TargetManifest]; fn bin<'t>(&'t self, target: &'_ str) -> Option<&'t Self::TargetManifest> { - self.bins().into_iter().find(|b| b.target() == target) + self.bins().iter().find(|b| b.target() == target) } fn example<'t>(&'t self, target: &'_ str) -> Option<&'t Self::TargetManifest> { - self.examples().into_iter().find(|b| b.target() == target) + self.examples().iter().find(|b| b.target() == target) } fn bin_targets(&self) -> impl IntoIterator; @@ -115,10 +113,10 @@ pub trait MetadataSource { } fn bins_iter(&self) -> Option> { - (!self.bins().is_empty()).then_some(self.bins().into_iter()) + (!self.bins().is_empty()).then_some(self.bins().iter()) } fn examples_iter(&self) -> Option> { - (!self.examples().is_empty()).then_some(self.examples().into_iter()) + (!self.examples().is_empty()).then_some(self.examples().iter()) } fn all_targets_iter(&self) -> impl Iterator { @@ -150,14 +148,12 @@ pub trait MetadataSource { } else { None } - } else { - if let Some(target) = self.bin(target) { - let trg = base.override_with_extra_ref(target); - Some(trg.into_owned()) - } else { - None - } - } + } else if let Some(target) = self.bin(target) { + let trg = base.override_with_extra_ref(target); + Some(trg.into_owned()) + } else { + None + } } fn manifest_for_target_any(&self, target: &str) -> Option { @@ -176,8 +172,8 @@ impl MetadataSource for &T { fn manifest(&self) -> impl ManifestSourceOptExt { (*self).manifest() } - fn bins<'t>(&'t self) -> &'t [Self::TargetManifest] { ::bins(*self) } - fn examples<'t>(&'t self) -> &'t [Self::TargetManifest] { ::examples(*self) } + fn bins(&self) -> &[Self::TargetManifest] { ::bins(*self) } + fn examples(&self) -> &[Self::TargetManifest] { ::examples(*self) } fn bin_targets(&self) -> impl IntoIterator { (*self).bin_targets() } fn example_targets(&self) -> impl IntoIterator { (*self).example_targets() } @@ -294,14 +290,14 @@ pub trait ManifestSourceOptExt: ManifestSourceOpt { impl ManifestSourceOpt for T { const MAY_BE_INCOMPLETE: bool = false; fn name(&self) -> Option<&str> { Some(ManifestSource::name(self)) } - fn version(&self) -> Option<&str> { Some(ManifestSource::version(self).as_ref()) } - fn author(&self) -> Option<&str> { Some(ManifestSource::author(self).as_ref()) } - fn bundle_id(&self) -> Option<&str> { Some(ManifestSource::bundle_id(self).as_ref()) } - fn description(&self) -> Option<&str> { Some(ManifestSource::description(self).as_ref()) } - fn image_path(&self) -> Option<&str> { Some(ManifestSource::image_path(self).as_ref()) } - fn launch_sound_path(&self) -> Option<&str> { Some(ManifestSource::launch_sound_path(self).as_ref()) } - fn content_warning(&self) -> Option<&str> { Some(ManifestSource::content_warning(self).as_ref()) } - fn content_warning2(&self) -> Option<&str> { Some(ManifestSource::content_warning2(self).as_ref()) } + fn version(&self) -> Option<&str> { Some(ManifestSource::version(self)) } + fn author(&self) -> Option<&str> { Some(ManifestSource::author(self)) } + fn bundle_id(&self) -> Option<&str> { Some(ManifestSource::bundle_id(self)) } + fn description(&self) -> Option<&str> { Some(ManifestSource::description(self)) } + fn image_path(&self) -> Option<&str> { Some(ManifestSource::image_path(self)) } + fn launch_sound_path(&self) -> Option<&str> { Some(ManifestSource::launch_sound_path(self)) } + fn content_warning(&self) -> Option<&str> { Some(ManifestSource::content_warning(self)) } + fn content_warning2(&self) -> Option<&str> { Some(ManifestSource::content_warning2(self)) } fn build_number(&self) -> Option { ManifestSource::build_number(self) } }