Skip to content

Commit 198bdec

Browse files
authored
chore: Update cli and tui to 2024 edition (#990)
1 parent 2f75d52 commit 198bdec

File tree

1,118 files changed

+2926
-2773
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,118 files changed

+2926
-2773
lines changed

.github/workflows/linters.yml

Lines changed: 10 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ jobs:
5656
permissions:
5757
contents: read
5858
security-events: write
59+
strategy:
60+
matrix:
61+
include:
62+
- rust_ver: 1.76
63+
clippy_args: "-p openstack_sdk -p structable_derive"
64+
- rust_ver: 1.85
65+
clippy_args: "-p openstack_cli -p openstack_tui"
5966
steps:
6067

6168
- name: Harden Runner
@@ -65,10 +72,10 @@ jobs:
6572

6673
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6774

68-
- name: Install Rust ${{ env.rust_min }}
75+
- name: Install Rust ${{ matrix.rust_ver }}
6976
uses: dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0 # stable
7077
with:
71-
toolchain: ${{ env.rust_min }}
78+
toolchain: ${{ matrix.rust_ver }}
7279
components: rustfmt, clippy
7380

7481
- uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
@@ -85,51 +92,7 @@ jobs:
8592
run:
8693
cargo clippy
8794
--lib --tests
88-
--all-features -p openstack_sdk -p openstack_cli
89-
--message-format=json | ${CARGO_HOME}/bin/clippy-sarif | tee rust-clippy-results.sarif | ${CARGO_HOME}/bin/sarif-fmt
90-
91-
- name: Upload analysis results to GitHub
92-
uses: github/codeql-action/upload-sarif@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10
93-
with:
94-
sarif_file: rust-clippy-results.sarif
95-
wait-for-processing: true
96-
97-
clippy-tui:
98-
name: Run clippy for TUI on the minimum supported toolchain
99-
runs-on: ubuntu-latest
100-
permissions:
101-
contents: read
102-
security-events: write
103-
steps:
104-
105-
- name: Harden Runner
106-
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
107-
with:
108-
egress-policy: audit
109-
110-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
111-
112-
- name: Install Rust 1.80
113-
uses: dtolnay/rust-toolchain@56f84321dbccf38fb67ce29ab63e4754056677e0 # stable
114-
with:
115-
toolchain: "1.80"
116-
components: rustfmt, clippy
117-
118-
- uses: swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
119-
120-
- name: Install cargo-binstall
121-
uses: taiki-e/install-action@1426bdb9e21b806f1cae604ab3dfc05e174bf885 # v2.49.16
122-
with:
123-
tool: cargo-binstall
124-
125-
- name: Install required cargo
126-
run: cargo binstall clippy-sarif sarif-fmt --force
127-
128-
- name: Run rust-clippy
129-
run:
130-
cargo clippy
131-
--tests
132-
--all-features -p openstack_tui
95+
--all-features ${{ clippy_args }}
13396
--message-format=json | ${CARGO_HOME}/bin/clippy-sarif | tee rust-clippy-results.sarif | ${CARGO_HOME}/bin/sarif-fmt
13497

13598
- name: Upload analysis results to GitHub

openstack_cli/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ authors = [
66
]
77
description = "OpenStack client rewritten in Rust"
88
categories = ["command-line-interface"]
9-
rust-version.workspace = true
10-
edition.workspace = true
9+
edition = "2024"
10+
rust-version = "1.85" # MSRV
1111
license.workspace = true
1212
homepage.workspace = true
1313
repository.workspace = true

openstack_cli/src/api/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ use tracing::info;
2222
use url::Url;
2323

2424
use openstack_sdk::{
25+
AsyncOpenStack,
2526
api::{AsyncClient, RestClient},
2627
types::ServiceType,
27-
AsyncOpenStack,
2828
};
2929

30-
use crate::common::parse_key_val;
31-
use crate::output::OutputProcessor;
3230
use crate::Cli;
3331
use crate::OpenStackCliError;
32+
use crate::common::parse_key_val;
33+
use crate::output::OutputProcessor;
3434

3535
fn url_to_http_uri(url: Url) -> Uri {
3636
url.as_str()

openstack_cli/src/auth/show.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
use clap::Parser;
1717
use tracing::info;
1818

19-
use crate::output::{self, OutputProcessor};
2019
use crate::Cli;
2120
use crate::OpenStackCliError;
2221
use crate::OutputConfig;
2322
use crate::StructTable;
23+
use crate::output::{self, OutputProcessor};
2424

25-
use openstack_sdk::types::identity::v3::AuthResponse;
2625
use openstack_sdk::AsyncOpenStack;
26+
use openstack_sdk::types::identity::v3::AuthResponse;
2727

2828
/// Show current authorization information for the cloud
2929
///

openstack_cli/src/bin/osc.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,15 @@ fn initialize_panic_handler() -> Result<()> {
9090
.issue_url(concat!(env!("CARGO_PKG_REPOSITORY"), "/issues/new"))
9191
.issue_filter(|kind| match kind {
9292
color_eyre::ErrorKind::NonRecoverable(_) => true,
93-
color_eyre::ErrorKind::Recoverable(error) => {
94-
match error.downcast_ref::<OpenStackCliError>() {
95-
Some(OpenStackCliError::Auth { .. }) => false,
96-
Some(OpenStackCliError::ConfigError { .. }) => false,
97-
Some(OpenStackCliError::ConnectionNotFound { .. }) => false,
98-
Some(OpenStackCliError::OpenStackApi { .. }) => false,
99-
Some(OpenStackCliError::ReScope { .. }) => false,
100-
Some(OpenStackCliError::InputParameters { .. }) => false,
101-
_ => true,
102-
}
103-
}
93+
color_eyre::ErrorKind::Recoverable(error) => !matches!(
94+
error.downcast_ref::<OpenStackCliError>(),
95+
Some(OpenStackCliError::Auth { .. })
96+
| Some(OpenStackCliError::ConfigError { .. })
97+
| Some(OpenStackCliError::ConnectionNotFound { .. })
98+
| Some(OpenStackCliError::OpenStackApi { .. })
99+
| Some(OpenStackCliError::ReScope { .. })
100+
| Some(OpenStackCliError::InputParameters { .. })
101+
),
104102
})
105103
.add_issue_metadata("version", env!("CARGO_PKG_VERSION"))
106104
.add_issue_metadata("command", command)

openstack_cli/src/block_storage/v3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
//! Block storage v3 commands
1616
use clap::{Parser, Subcommand};
1717

18-
use openstack_sdk::{types::ServiceType, AsyncOpenStack};
18+
use openstack_sdk::{AsyncOpenStack, types::ServiceType};
1919

2020
use crate::{Cli, OpenStackCliError};
2121

openstack_cli/src/block_storage/v3/attachment/create_327.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ use tracing::info;
2525

2626
use openstack_sdk::AsyncOpenStack;
2727

28-
use crate::output::OutputProcessor;
2928
use crate::Cli;
3029
use crate::OpenStackCliError;
3130
use crate::OutputConfig;
3231
use crate::StructTable;
32+
use crate::output::OutputProcessor;
3333

3434
use crate::common::parse_key_val;
35-
use openstack_sdk::api::block_storage::v3::attachment::create_327;
3635
use openstack_sdk::api::QueryAsync;
36+
use openstack_sdk::api::block_storage::v3::attachment::create_327;
3737
use serde_json::Value;
3838
use structable_derive::StructTable;
3939

openstack_cli/src/block_storage/v3/attachment/create_354.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ use tracing::info;
2525

2626
use openstack_sdk::AsyncOpenStack;
2727

28-
use crate::output::OutputProcessor;
2928
use crate::Cli;
3029
use crate::OpenStackCliError;
3130
use crate::OutputConfig;
3231
use crate::StructTable;
32+
use crate::output::OutputProcessor;
3333

3434
use crate::common::parse_key_val;
3535
use clap::ValueEnum;
36-
use openstack_sdk::api::block_storage::v3::attachment::create_354;
3736
use openstack_sdk::api::QueryAsync;
37+
use openstack_sdk::api::block_storage::v3::attachment::create_354;
3838
use serde_json::Value;
3939
use structable_derive::StructTable;
4040

openstack_cli/src/block_storage/v3/attachment/delete.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ use tracing::info;
2525

2626
use openstack_sdk::AsyncOpenStack;
2727

28-
use crate::output::OutputProcessor;
2928
use crate::Cli;
3029
use crate::OpenStackCliError;
3130
use crate::OutputConfig;
3231
use crate::StructTable;
32+
use crate::output::OutputProcessor;
3333

3434
use bytes::Bytes;
3535
use http::Response;
36-
use openstack_sdk::api::block_storage::v3::attachment::delete;
3736
use openstack_sdk::api::RawQueryAsync;
37+
use openstack_sdk::api::block_storage::v3::attachment::delete;
3838
use structable_derive::StructTable;
3939

4040
/// Delete an attachment.

openstack_cli/src/block_storage/v3/attachment/list.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ use tracing::info;
2525

2626
use openstack_sdk::AsyncOpenStack;
2727

28-
use crate::output::OutputProcessor;
2928
use crate::Cli;
3029
use crate::OpenStackCliError;
3130
use crate::OutputConfig;
3231
use crate::StructTable;
32+
use crate::output::OutputProcessor;
3333

34-
use openstack_sdk::api::block_storage::v3::attachment::list_detailed;
3534
use openstack_sdk::api::QueryAsync;
36-
use openstack_sdk::api::{paged, Pagination};
35+
use openstack_sdk::api::block_storage::v3::attachment::list_detailed;
36+
use openstack_sdk::api::{Pagination, paged};
3737
use serde_json::Value;
3838
use structable_derive::StructTable;
3939

0 commit comments

Comments
 (0)