Skip to content

Commit 7825ac5

Browse files
committed
upgrade rustc-version: 1.85 and edition "2024"
1 parent 3b79e55 commit 7825ac5

File tree

9 files changed

+29
-22
lines changed

9 files changed

+29
-22
lines changed

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[workspace]
22
members = ["crates/*", "examples/*"]
3-
resolver = "2"
3+
resolver = "3"
44

55
[workspace.package]
66
version = "0.0.13"
7-
edition = "2021"
8-
rust-version = "1.83"
7+
edition = "2024"
8+
rust-version = "1.85"
99
description = "cdk-ansible is a tool to generate Ansible playbooks from Rust code."
1010
homepage = "https://github.com/pollenjp/cdk-ansible"
1111
documentation = "https://docs.rs/cdk-ansible"

crates/cdk-ansible-cli/Cargo.toml

+8
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ anyhow.workspace = true
4141
regex.workspace = true
4242
fs-err.workspace = true
4343

44+
[lints.rust]
45+
# clippy::redundant_pub_crate conflicts with rustc::unreachable_pub #5369
46+
# https://github.com/rust-lang/rust-clippy/issues/5369
47+
# unreachable-pub = "warn"
48+
4449
[lints.clippy]
4550

4651
# category
@@ -62,16 +67,19 @@ branches_sharing_code = "allow"
6267
#
6368
# https://rust-lang.github.io/rust-clippy/master/index.html#blanket_clippy_restriction_lints
6469
blanket_clippy_restriction_lints = "allow"
70+
absolute_paths = "allow"
6571
arbitrary_source_item_ordering = "allow"
6672
implicit_return = "allow"
6773
min_ident_chars = "allow"
6874
missing_docs_in_private_items = "allow"
6975
mod_module_files = "allow"
7076
# FIXME: later
7177
print_stdout = "allow"
78+
pub_with_shorthand = "allow"
7279
question_mark_used = "allow"
7380
self_named_module_files = "allow"
7481
shadow_reuse = "allow"
7582
shadow_same = "allow"
7683
shadow_unrelated = "allow"
84+
single_call_fn = "allow"
7785
single_char_lifetime_names = "allow"

crates/cdk-ansible-cli/src/arg.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
use crate::version;
12
use cdk_ansible_static::EnvVars;
23
use clap::{command, Args, Parser, Subcommand, ValueEnum};
34
use std::path::PathBuf;
45

56
#[derive(Parser)]
6-
#[command(name = "cdk-ansible", author, long_version = crate::version::version().to_string())]
7+
#[command(name = "cdk-ansible", author, long_version = version::version().to_string())]
78
#[command(about = ".")]
89
#[command(propagate_version = true)]
910
#[command(
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use anyhow::Result;
22
use cdk_ansible_cli::run;
3-
use std::env;
43

54
fn main() -> Result<()> {
6-
run(env::args_os())?;
5+
run(std::env::args_os())?;
76
Ok(())
87
}

crates/cdk-ansible-cli/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ impl FilesystemOptions {
8181
/// Use [`anyhow::Result`] to handle errors.
8282
///
8383
#[inline]
84-
// #[expect(clippy::single_call_fn, reason = "better readability")]
8584
pub fn run<I, T>(args: I) -> Result<()>
8685
where
8786
I: IntoIterator<Item = T>,

crates/cdk-ansible-cli/src/settings.rs

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ pub struct ModuleSettings {
5555

5656
impl ModuleSettings {
5757
/// Convert the command line arguments to the settings
58-
#[expect(clippy::single_call_fn, reason = "better readability")]
5958
pub fn resolve(args: arg::ModuleArgs) -> Self {
6059
Self {
6160
output_dir: args.output_dir,

crates/cdk-ansible-cli/src/subcommand/module.rs

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::arg::ModuleArgs;
22
use crate::settings::{ModuleSettings, PkgUnit};
3-
use anyhow::{bail, Context as _, Result};
3+
use anyhow::{Context as _, Result, bail};
44
use core::fmt;
55
use indexmap::IndexMap;
66
use quote::{format_ident, quote};
@@ -29,13 +29,14 @@ static SUB_MOD_NAME: &str = "m";
2929
///
3030
/// * `CliError` - If the command line arguments are invalid.
3131
/// * `IoError` - If the configuration file is not found or cannot be read.
32-
#[expect(clippy::single_call_fn, reason = "better readability")]
3332
pub fn module(args: ModuleArgs) -> Result<()> {
3433
let args = ModuleSettings::resolve(args);
3534
let ans_modu_names = match (args.module_name, args.module_name_regex) {
3635
(Some(modu_name), None) => {
37-
vec![AnsibleModuleName::new(&modu_name)
38-
.with_context(|| format!("failed to parse module name: {modu_name}"))?]
36+
vec![
37+
AnsibleModuleName::new(&modu_name)
38+
.with_context(|| format!("failed to parse module name: {modu_name}"))?,
39+
]
3940
}
4041
(None, Some(regex)) => match_module_name(&regex)?,
4142
(None, None) => match_module_name("*")?,
@@ -310,8 +311,8 @@ fn create_cargo_toml(pkg_name: &str, pkg_dir: &Path) -> Result<()> {
310311
[package]
311312
name = "sample"
312313
version = "0.1.0"
313-
edition = "2021"
314-
rust-version = "1.83"
314+
edition.workspace = true
315+
rust-version.workspace = true
315316
"#,
316317
)?;
317318
if let Some(package) = manifest.package.as_mut() {
@@ -521,21 +522,21 @@ type AnsModuleJson = IndexMap<String, AnsModuleItem>;
521522

522523
#[derive(Debug, Clone, Serialize, Deserialize)]
523524
/// module field
524-
pub struct AnsModuleItem {
525+
struct AnsModuleItem {
525526
/// 'doc' field
526527
pub doc: AnsModuleDoc,
527528
}
528529

529530
#[derive(Debug, Clone, Serialize, Deserialize)]
530531
/// doc field
531-
pub struct AnsModuleDoc {
532+
struct AnsModuleDoc {
532533
/// 'options' field
533534
pub options: Option<IndexMap<String, AnsModuleDocOption>>,
534535
}
535536

536537
#[derive(Debug, Clone, Serialize, Deserialize)]
537538
/// doc option field
538-
pub struct AnsModuleDocOption {
539+
struct AnsModuleDocOption {
539540
// TODO: add description field
540541
// #[serde(default)]
541542
// pub description: Vec<String>,

crates/cdk-ansible-macro/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ pub fn attribute_env_vars_metadata(_attr: TokenStream, input: TokenStream) -> To
7070
}
7171
ImplItem::Fn(item) if !is_hidden(&item.attrs) => {
7272
// Extract the environment variable patterns.
73-
if let Some(pattern) = get_env_var_pattern_from_attr(&item.attrs) {
73+
match get_env_var_pattern_from_attr(&item.attrs) { Some(pattern) => {
7474
let doc = get_doc_comment(&item.attrs);
7575
Some((pattern, doc))
76-
} else {
76+
} _ => {
7777
None // Skip if pattern extraction fails.
78-
}
78+
}}
7979
}
8080
_ => None,
8181
})

examples/cdkam_ansible/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "cdkam_ansible"
33
version = "0.1.0"
4-
edition = "2021"
5-
rust-version = "1.83"
4+
edition.workspace = true
5+
rust-version.workspace = true
66

77
[dependencies]
88
anyhow = "1.0.95"

0 commit comments

Comments
 (0)