Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #22561: Update Rust tooling for 8.0 #4723

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion policies/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.66.1-bullseye
FROM rust:1.68.2-bullseye

ARG USER_ID=1000
COPY ci/user.sh .
Expand Down
9 changes: 2 additions & 7 deletions policies/rudder-module-type/src/cfengine/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,15 @@ impl FromStr for Class {
}
}

#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone, Copy, Default)]
#[serde(rename_all = "lowercase")]
pub(crate) enum ActionPolicy {
#[serde(alias = "nop")]
Warn,
#[default]
Fix,
}

impl Default for ActionPolicy {
fn default() -> Self {
ActionPolicy::Fix
}
}

impl From<ActionPolicy> for PolicyMode {
fn from(p: ActionPolicy) -> Self {
match p {
Expand Down
18 changes: 4 additions & 14 deletions policies/rudderc/src/ir/technique.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ impl fmt::Display for BlockReporting {
}
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
pub enum BlockReportingMode {
#[serde(rename = "worst-case-weighted-sum")]
WorstCaseWeightedSum,
Expand All @@ -238,6 +238,7 @@ pub enum BlockReportingMode {
Focus,
#[serde(rename = "weighted")]
#[serde(alias = "enabled")]
#[default]
Weighted,
#[serde(rename = "disabled")]
Disabled,
Expand All @@ -259,22 +260,11 @@ impl fmt::Display for BlockReportingMode {
}
}

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
pub enum LeafReporting {
#[serde(rename = "enabled")]
#[default]
Enabled,
#[serde(rename = "disabled")]
Disabled,
}

impl Default for BlockReportingMode {
fn default() -> Self {
BlockReportingMode::Weighted
}
}

impl Default for LeafReporting {
fn default() -> Self {
LeafReporting::Enabled
}
}
8 changes: 5 additions & 3 deletions policies/rudderc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2022 Normation SAS

use std::fs::create_dir_all;
use std::path::{Path, PathBuf};
use std::{
fs::create_dir_all,
path::{Path, PathBuf},
};

use anyhow::{Context, Result};

Expand Down Expand Up @@ -80,12 +82,12 @@ pub fn run(args: MainArgs) -> Result<()> {

// Actions
pub mod action {
use std::process::Command;
use std::{
fs,
fs::{create_dir, read_to_string, File},
io::{self, Write},
path::{Path, PathBuf},
process::Command,
};

use anyhow::{bail, Context, Result};
Expand Down
2 changes: 1 addition & 1 deletion policies/rudderc/src/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use colored::Colorize;
use env_logger::fmt::{Color, Formatter, Style, StyledValue};
use log::{info, Level, LevelFilter, Record};

fn colored_level<'a>(style: &'a mut Style, level: Level) -> StyledValue<'a, &'static str> {
fn colored_level(style: &mut Style, level: Level) -> StyledValue<&'static str> {
match level {
Level::Warn => style
.set_color(Color::Yellow)
Expand Down
2 changes: 1 addition & 1 deletion policies/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.66.1"
channel = "1.68.2"
Loading