Skip to content

Commit

Permalink
Bump the known_good_semver group with 5 updates (#69)
Browse files Browse the repository at this point in the history
* Bump the known_good_semver group with 5 updates

Bumps the known_good_semver group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.78` | `1.0.79` |
| [clap](https://github.com/clap-rs/clap) | `4.4.12` | `4.4.13` |
| [semver](https://github.com/dtolnay/semver) | `1.0.20` | `1.0.21` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.109` | `1.0.111` |
| [serde_yaml](https://github.com/dtolnay/serde-yaml) | `0.9.29` | `0.9.30` |


Updates `anyhow` from 1.0.78 to 1.0.79
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](dtolnay/anyhow@1.0.78...1.0.79)

Updates `clap` from 4.4.12 to 4.4.13
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](clap-rs/clap@v4.4.12...v4.4.13)

Updates `semver` from 1.0.20 to 1.0.21
- [Release notes](https://github.com/dtolnay/semver/releases)
- [Commits](dtolnay/semver@1.0.20...1.0.21)

Updates `serde_json` from 1.0.109 to 1.0.111
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](serde-rs/json@v1.0.109...v1.0.111)

Updates `serde_yaml` from 0.9.29 to 0.9.30
- [Release notes](https://github.com/dtolnay/serde-yaml/releases)
- [Commits](dtolnay/serde-yaml@0.9.29...0.9.30)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: known_good_semver
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: known_good_semver
- dependency-name: semver
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: known_good_semver
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: known_good_semver
- dependency-name: serde_yaml
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: known_good_semver
...

Signed-off-by: dependabot[bot] <support@github.com>

* Clippy

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
dependabot[bot] and ggwpez authored Jan 9, 2024
1 parent 22e3b53 commit 512b724
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 60 deletions.
40 changes: 20 additions & 20 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ harness = false
required-features = [ "benchmarking" ]

[dependencies]
anyhow = { version = "1.0.78", optional = true }
anyhow = { version = "1.0.79", optional = true }
assert_cmd = { version = "2.0.12", optional = true }
cargo_metadata = "0.18.1"
clap = { version = "4.4.12", features = ["derive", "cargo"] }
clap = { version = "4.4.13", features = ["derive", "cargo"] }
colour = { version = "0.7.0", optional = true }
criterion = { version = "0.5", optional = true }
env_logger = { version = "0.10.1", features = [ "auto-color", "humantime" ], optional = true }
Expand All @@ -30,14 +30,14 @@ itertools = "0.12.0"
log = { version = "0.4.20", optional = true }
semver = "1"
serde = "1.0.193"
serde_json = "1.0.109"
serde_yaml = "0.9.29"
serde_json = "1.0.111"
serde_yaml = "0.9.30"
tempfile = { version = "3.9.0", optional = true }
toml_edit = "0.21.0"
tracing = { version = "0.1.40", optional = true }

[dev-dependencies]
anyhow = "1.0.78"
anyhow = "1.0.79"
glob = "0.3.1"
lazy_static = "1.4.0"
pretty_assertions = "1.4.0"
Expand Down
34 changes: 15 additions & 19 deletions benches/dag.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-only
// SPDX-FileCopyrightText: Oliver Tale-Yazdi <oliver@tasty.limo>

use assert_cmd::cargo;
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use rand::{Rng, SeedableRng};
use zepter::{
cmd::lint::{build_feature_dag, CrateAndFeature},
prelude::*,
};
use zepter::{cmd::lint::build_feature_dag, prelude::*};

fn build_dag(nodes: usize, edges: usize) -> Dag<usize> {
let mut rng = rand::rngs::StdRng::seed_from_u64(42);
Expand All @@ -33,37 +29,37 @@ fn dag(c: &mut Criterion) {
c.bench_function("DAG 1k/1k", |b| {
b.iter(|| {
any_path(&dag);
black_box(())
})
black_box(());
});
});
let dag = build_dag(1000, 5000);
c.bench_function("DAG 1k/5k", |b| {
b.iter(|| {
any_path(&dag);
black_box(())
})
black_box(());
});
});
let dag = build_dag(10000, 1000);
c.bench_function("DAG 10k/1k", |b| {
b.iter(|| {
any_path(&dag);
black_box(())
})
black_box(());
});
});
let dag = build_dag(10000, 50000);
c.bench_function("DAG 10k/50k", |b| {
b.iter(|| {
any_path(&dag);
black_box(())
})
black_box(());
});
});
}

fn polkadot_sdk(c: &mut Criterion) {
let path = std::env::var("META_JSON_PATH").unwrap_or("meta.json".into());
let path = std::fs::canonicalize(path).unwrap();
let file = std::fs::read_to_string(&path).unwrap();
let mut meta = serde_json::from_str::<cargo_metadata::Metadata>(&file).unwrap();
let file = std::fs::read_to_string(path).unwrap();
let meta = serde_json::from_str::<cargo_metadata::Metadata>(&file).unwrap();

let pkgs = &meta.packages;
let dag = build_feature_dag(&meta, pkgs);
Expand All @@ -77,14 +73,14 @@ fn polkadot_sdk(c: &mut Criterion) {

let from = dag.lhs_iter().find(|c| c.0.starts_with("kitchensink-runtime ")).unwrap();
let to = dag.rhs_iter().find(|c| c.0.starts_with("sp-io ")).unwrap();
assert!(dag.lhs_contains(&from), "LHS:\n{:?}", dag.lhs_nodes().collect::<Vec<_>>());
assert!(dag.rhs_contains(&to));
assert!(dag.lhs_contains(from), "LHS:\n{:?}", dag.lhs_nodes().collect::<Vec<_>>());
assert!(dag.rhs_contains(to));

c.bench_function("Polkadot-SDK / DAG / reachability: false", |b| {
b.iter(|| {
let p = dag.any_path(&from, &to);
let p = dag.any_path(from, to);
black_box(p)
})
});
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl DebugCmd {
let dag = build_feature_dag(&meta, &meta.packages);

if !self.no_root {
println!("Root: {}", meta.workspace_root.to_string());
println!("Root: {}", meta.workspace_root);
}
println!("Num workspace members: {}", meta.workspace_members.len());
println!("Num dependencies: {}", meta.packages.len());
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/lint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ impl PropagateFeatureCmd {
}
// TODO handle default features.
// Resolve the dep according to the metadata.
let Some(dep) = resolve_dep(pkg, dep, &meta) else {
let Some(dep) = resolve_dep(pkg, dep, meta) else {
// Either outside workspace or not resolved, possibly due to not being used at
// all because of the target or whatever.
continue
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ impl CargoArgs {
let meta = cmd.exec().map_err(|e| format!("Failed to load metadata: {e}"))?;

if let Some(path) = &self.keep_meta {
std::fs::write(&path, serde_json::to_string_pretty(&meta).unwrap()).unwrap();
std::fs::write(path, serde_json::to_string_pretty(&meta).unwrap()).unwrap();
log::info!("Wrote metadata to {}", path.display());
}

Expand Down
2 changes: 1 addition & 1 deletion src/cmd/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl RunCmd {
let config = self.args.config.load().expect("Invalid config file");

let name = self.args.workflow.as_deref().unwrap_or(WORKFLOW_DEFAULT_NAME);
let Some(workflow) = config.workflow(&name) else {
let Some(workflow) = config.workflow(name) else {
panic!("Workflow '{}' not found", name);
};

Expand Down
14 changes: 8 additions & 6 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl Default for Toggle {
}
}

pub const WELL_KNOWN_CFG_PATHS: &[&'static str] = &["zepter.yaml", ".zepter.yaml"];
pub const WELL_KNOWN_CFG_PATHS: &[&str] = &["zepter.yaml", ".zepter.yaml"];

/// Search for `zepter.yaml`, `zepter`, `.zepter.yaml` or `.zepter` in the folders:
/// - `./`
Expand Down Expand Up @@ -111,18 +111,20 @@ impl ConfigArgs {

fn locate_workspace(&self) -> Result<PathBuf, String> {
let mut cmd = std::process::Command::new("cargo");
cmd.arg("locate-project").args(&["--workspace", "--offline", "--locked"]);
cmd.arg("locate-project").args(["--workspace", "--offline", "--locked"]);
if let Some(path) = &self.manifest_path {
cmd.arg("--manifest-path").arg(path);
}
let output = cmd.output().expect("Failed to run `cargo locate-project`");
let path = output.stdout;
let path =
String::from_utf8(path).expect("Failed to parse output of `cargo locate-project`");
let path: serde_json::Value = serde_json::from_str(&path).expect(&format!(
"Failed to parse output of `cargo locate-project`: '{}'",
String::from_utf8_lossy(&output.stderr)
));
let path: serde_json::Value = serde_json::from_str(&path).unwrap_or_else(|_| {
panic!(
"Failed to parse output of `cargo locate-project`: '{}'",
String::from_utf8_lossy(&output.stderr)
)
});
let path = path["root"].as_str().expect("Failed to parse output of `cargo locate-project`");
let path = PathBuf::from(path);
let root = path.parent().expect("Failed to get parent of workspace root");
Expand Down
2 changes: 2 additions & 0 deletions src/config/semver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub struct Semver {
impl TryFrom<&str> for Semver {
type Error = ();

#[allow(clippy::map_err_ignore)]
fn try_from(s: &str) -> Result<Self, Self::Error> {
let mut parts = s.split('.');
let major = parts.next().ok_or(())?.parse().map_err(|_| ())?;
Expand All @@ -45,6 +46,7 @@ impl Display for Semver {
}

impl Semver {
#[allow(clippy::map_err_ignore)]
pub fn from_serde<'de, D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
Expand Down
2 changes: 1 addition & 1 deletion src/config/workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl FromStr for WorkflowFile {
type Err = String;

fn from_str(content: &str) -> Result<Self, Self::Err> {
let parsed = serde_yaml::from_str::<WorkflowFile>(&content)
let parsed = serde_yaml::from_str::<WorkflowFile>(content)
.map_err(|e| format!("yaml parsing: {}", e))?;

if parsed.version.format != (1, 0, 0).into() {
Expand Down
2 changes: 1 addition & 1 deletion src/dag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ where
}

pub fn lhs_iter(&self) -> impl Iterator<Item = &T> {
self.edges.iter().map(|(k, _)| k)
self.edges.keys()
}

pub fn rhs_iter(&self) -> impl Iterator<Item = &T> {
Expand Down
7 changes: 4 additions & 3 deletions src/mock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ impl Case {

impl Drop for CaseCleanupGuard {
fn drop(&mut self) {
self.cfg_path.take().map(|p| fs::remove_file(p).unwrap());
if let Some(p) = self.cfg_path.take() {
fs::remove_file(p).unwrap();
}
}
}

Expand Down Expand Up @@ -229,10 +231,9 @@ impl ZepterConfig {
);
if let Some(verbatim) = &self.verbatim {
fs::write(&to_path, verbatim)?;
dbg!("Writing to path:", &to_path);
} else if let Some(from_path) = &self.from_path {
let from_path = root.join(from_path);
fs::copy(&from_path, &to_path)?;
fs::copy(from_path, &to_path)?;
}

Ok(to_path)
Expand Down
1 change: 0 additions & 1 deletion tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ fn integration() {
cmd.current_dir(workspace.as_path());
}

dbg!(format!("{:?}", cmd));
// remove empty trailing and suffix lines
let res = cmd.output().unwrap();
if let Some(code) = case.code {
Expand Down

0 comments on commit 512b724

Please sign in to comment.