Skip to content

Commit

Permalink
Upgrade rust toolchain to 1.79 (#42)
Browse files Browse the repository at this point in the history
Fixed all lint errors from the cargo clippy in the new version.
  • Loading branch information
youyuanwu authored Jun 21, 2024
1 parent 1a52ebb commit 29a7a3a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 36 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install rust stable
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.78.0
toolchain: 1.79.0
components: rustfmt, clippy

- name: Run cargo check
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
- name: Install rust stable
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.78.0
toolchain: 1.79.0
components: rustfmt, clippy

- name: Run cargo check
Expand Down
3 changes: 2 additions & 1 deletion crates/libs/com/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ extern crate windows;
clippy::missing_safety_doc,
clippy::too_many_arguments,
clippy::extra_unused_lifetimes,
clippy::useless_transmute
clippy::useless_transmute,
clippy::missing_transmute_annotations // winbindgen needs to fix this
)]
pub mod Microsoft;

Expand Down
34 changes: 14 additions & 20 deletions crates/libs/core/src/conf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// features of config-rs.

use config::{ConfigError, Source};
use tracing::info;
use tracing::debug;

use crate::runtime::config::ConfigurationPackage;
pub use config::Config;
Expand Down Expand Up @@ -41,25 +41,19 @@ impl Source for FabricConfigSource {
let uri_origion = String::from("fabric source");
let mut res = config::Map::new();
let settings = self.inner.get_settings();
settings
.sections
.iter()
.enumerate()
.for_each(|(_, section)| {
let section_name = section.name.to_string();
info!("Section: {}", section_name);
section.parameters.iter().enumerate().for_each(|(_, p)| {
let param_name = p.name.to_string();
let param_val = p.value.to_string();
info!("Param: {:?}", param_name);
let val = config::Value::new(
Some(&uri_origion),
config::ValueKind::String(param_val),
);
// section and param is separated by a dot.
res.insert(section_name.clone() + "." + &param_name, val);
})
});
settings.sections.iter().for_each(|section| {
let section_name = section.name.to_string();
debug!("Section: {}", section_name);
section.parameters.iter().for_each(|p| {
let param_name = p.name.to_string();
let param_val = p.value.to_string();
debug!("Param: {} Val: {}", param_name, param_val);
let val =
config::Value::new(Some(&uri_origion), config::ValueKind::String(param_val));
// section and param is separated by a dot.
res.insert(section_name.clone() + "." + &param_name, val);
})
});
Ok(res)
}
}
19 changes: 7 additions & 12 deletions crates/samples/echomain/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,13 @@ fn validate_configs(actctx: &ActivationContext) {
.get_configuration_package(&HSTRING::from("Config"))
.unwrap();
let settings = config.get_settings();
settings
.sections
.iter()
.enumerate()
.for_each(|(_, section)| {
info!("Section: {}", section.name);
section
.parameters
.iter()
.enumerate()
.for_each(|(_, p)| info!("Param: {:?}", p))
});
settings.sections.iter().for_each(|section| {
info!("Section: {}", section.name);
section
.parameters
.iter()
.for_each(|p| info!("Param: {:?}", p))
});

// get the required config
let (v, encrypt) = config
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# cargo + rustup will use this to consistently build the project
# with the same version across all checkouts and environments
[toolchain]
channel = "1.78.0"
channel = "1.79.0"
profile = "default"

0 comments on commit 29a7a3a

Please sign in to comment.