Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Update Rust edition to 2021 across all crates (#3392)
Browse files Browse the repository at this point in the history
  • Loading branch information
Porges committed Aug 8, 2023
1 parent d53646e commit 8980988
Show file tree
Hide file tree
Showing 27 changed files with 44 additions and 39 deletions.
4 changes: 2 additions & 2 deletions src/agent/.rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
edition = "2018"
newline_style = "Native"
edition = "2021"
newline_style = "Native"
2 changes: 2 additions & 0 deletions src/agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ members = [
"stacktrace-parser",
]

resolver = "2"

[profile.release]
lto = "thin"
# Per https://fasterthanli.me/articles/why-is-my-rust-build-so-slow:
Expand Down
2 changes: 1 addition & 1 deletion src/agent/atexit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "atexit"
version = "0.1.0"
license = "MIT"
authors = ["fuzzing@microsoft.com"]
edition = "2018"
edition = "2021"

[dependencies]
ctrlc = "3.4.0"
Expand Down
4 changes: 2 additions & 2 deletions src/agent/debugger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "debugger"
version = "0.1.0"
authors = ["fuzzing@microsoft.com"]
edition = "2018"
edition = "2021"
license = "MIT"

[dependencies]
Expand Down Expand Up @@ -31,5 +31,5 @@ features = [
"synchapi",
"werapi",
"winbase",
"winerror"
"winerror",
]
2 changes: 1 addition & 1 deletion src/agent/input-tester/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "input-tester"
version = "0.1.0"
authors = ["fuzzing@microsoft.com"]
edition = "2018"
edition = "2021"
license = "MIT"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/agent/libclusterfuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "libclusterfuzz"
version = "0.0.1"
authors = ["fuzzing@microsoft.com>"]
edition = "2018"
edition = "2021"
license = "Apache-2.0"
description = "Minimal porting of features from libclusterfuzz"

Expand Down
2 changes: 1 addition & 1 deletion src/agent/onefuzz-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "onefuzz-agent"
version = "0.1.0"
authors = ["fuzzing@microsoft.com"]
edition = "2018"
edition = "2021"
publish = false
license = "MIT"

Expand Down
2 changes: 1 addition & 1 deletion src/agent/onefuzz-agent/src/heartbeat.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

use crate::onefuzz::heartbeat::HeartbeatClient;
use anyhow::Result;
use onefuzz::heartbeat::HeartbeatClient;
use reqwest::Url;
use serde::{self, Deserialize, Serialize};
use uuid::Uuid;
Expand Down
1 change: 0 additions & 1 deletion src/agent/onefuzz-agent/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ extern crate downcast_rs;
extern crate anyhow;
#[macro_use]
extern crate onefuzz_telemetry;
extern crate onefuzz;

use crate::{
config::StaticConfig, coordinator::StateUpdateEvent, heartbeat::init_agent_heartbeat,
Expand Down
2 changes: 1 addition & 1 deletion src/agent/onefuzz-agent/src/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::failure::save_failure;
use backtrace::Backtrace;
use std::{panic, sync::Once};

fn panic_hook(info: &panic::PanicInfo) {
fn panic_hook(info: &panic::PanicInfo<'_>) {
let err = anyhow!("supervisor panicked: {}\n{:?}", info, Backtrace::new());
if let Err(err) = save_failure(&err, uuid::Uuid::nil()) {
error!("unable to write panic log: {:?}", err);
Expand Down
2 changes: 1 addition & 1 deletion src/agent/onefuzz-agent/src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl From<&Scheduler> for NodeState {
}

impl fmt::Display for Scheduler {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let s = match self {
Self::Free(..) => "Scheduler::Free",
Self::SettingUp(..) => "Scheduler::SettingUp",
Expand Down
4 changes: 2 additions & 2 deletions src/agent/onefuzz-task/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "onefuzz-task"
version = "0.2.0"
authors = ["fuzzing@microsoft.com"]
edition = "2018"
edition = "2021"
publish = false
license = "MIT"

Expand Down Expand Up @@ -72,7 +72,7 @@ azure_storage_blobs = { version = "0.13", default-features = false, features = [
] }

flexi_logger = "0.25"
schemars = {version = "0.8.12", features = ["uuid1"]}
schemars = { version = "0.8.12", features = ["uuid1"] }

[dev-dependencies]
pretty_assertions = "1.4"
2 changes: 1 addition & 1 deletion src/agent/onefuzz-telemetry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "onefuzz-telemetry"
version = "0.1.0"
authors = ["fuzzing@microsoft.com"]
edition = "2018"
edition = "2021"
license = "MIT"

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/agent/onefuzz-telemetry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl MicrosoftTelemetryKey {
}

impl fmt::Display for MicrosoftTelemetryKey {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}
Expand All @@ -42,7 +42,7 @@ impl InstanceTelemetryKey {
}

impl fmt::Display for InstanceTelemetryKey {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/agent/onefuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "onefuzz"
version = "0.1.0"
authors = ["fuzzing@microsoft.com"]
edition = "2018"
edition = "2021"
publish = false
license = "MIT"

Expand Down
4 changes: 2 additions & 2 deletions src/agent/onefuzz/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ impl<T> From<T> for Secret<T> {
}

impl<T> fmt::Debug for Secret<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "Secret(<REDACTED>)")
}
}

impl<T> fmt::Display for Secret<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "<REDACTED>")
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/agent/onefuzz/src/az_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ enum Mode {
}

impl fmt::Display for Mode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let as_str = match self {
Mode::Copy => "copy",
Mode::Sync => "sync",
Expand Down
12 changes: 6 additions & 6 deletions src/agent/onefuzz/src/blob/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ impl BlobUrl {
}

impl fmt::Debug for BlobUrl {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", redact_query_sas_sig(&self.url()))
}
}

impl fmt::Display for BlobUrl {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::AzureBlob(_) => write!(
f,
Expand Down Expand Up @@ -200,7 +200,7 @@ impl BlobContainerUrl {
}

impl fmt::Debug for BlobContainerUrl {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::BlobContainer(url) => write!(f, "{}", redact_query_sas_sig(url)),
Self::Path(p) => write!(f, "{}", p.display()),
Expand All @@ -209,7 +209,7 @@ impl fmt::Debug for BlobContainerUrl {
}

impl fmt::Display for BlobContainerUrl {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let Some(file_path) = self.as_file_path() {
write!(f, "{file_path:?}")
} else if let (Some(account), Some(container)) = (self.account(), self.container()) {
Expand Down Expand Up @@ -327,7 +327,7 @@ struct BlobContainerUrlVisitor;
impl<'de> de::Visitor<'de> for BlobContainerUrlVisitor {
type Value = BlobContainerUrl;

fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "a valid blob storage container URL")
}

Expand All @@ -353,7 +353,7 @@ struct BlobUrlVisitor;
impl<'de> de::Visitor<'de> for BlobUrlVisitor {
type Value = BlobUrl;

fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "a valid blob storage URL")
}

Expand Down
2 changes: 1 addition & 1 deletion src/agent/onefuzz/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ impl<'a> Expand<'a> {
let arg = arg.as_ref().to_owned();
let mut errors = Vec::new();

let result = VAR_RE.replace_all(&arg, |captures: &regex::Captures| -> String {
let result = VAR_RE.replace_all(&arg, |captures: &regex::Captures<'_>| -> String {
let matched = captures.get(0).unwrap().as_str(); // capture 0 must always be present here
match self.values.get_key_value(matched) {
Some((placeholder, ev)) => {
Expand Down
2 changes: 1 addition & 1 deletion src/agent/onefuzz/src/triage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ pub struct Frame {
}

impl fmt::Display for Frame {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if let (Some(function), Some(module)) = (&self.function, &self.module) {
return write!(
f,
Expand Down
2 changes: 1 addition & 1 deletion src/agent/stacktrace-parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "stacktrace-parser"
version = "0.1.0"
authors = ["<fuzzing@microsoft.com>"]
edition = "2018"
edition = "2021"
license = "MIT"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/agent/storage-queue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "storage-queue"
version = "0.1.0"
authors = ["fuzzing@microsoft.com"]
edition = "2018"
edition = "2021"
license = "MIT"

[dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/agent/win-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "win-util"
version = "0.1.0"
authors = ["fuzzing@microsoft.com"]
edition = "2018"
edition = "2021"
license = "MIT"

[dependencies]
Expand Down Expand Up @@ -32,5 +32,5 @@ features = [
"werapi",
"winbase",
"winerror",
"wow64apiset"
"wow64apiset",
]
4 changes: 2 additions & 2 deletions src/integration-tests/libfuzzer-rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "rust_fuzz_example"
version = "0.1.0"
license = "MIT"
authors = ["<fuzzing@microsoft.com>"]
edition = "2018"
edition = "2021"

[dependencies]
libc = "0.2.79"
libc = "0.2.79"
2 changes: 1 addition & 1 deletion src/integration-tests/libfuzzer-rust/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "rust-fuzz"
version = "0.0.0"
authors = ["Automatically generated"]
publish = false
edition = "2018"
edition = "2021"

[package.metadata]
cargo-fuzz = true
Expand Down
2 changes: 1 addition & 1 deletion src/proxy-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "onefuzz-proxy-manager"
version = "0.0.1"
authors = ["fuzzing@microsoft.com"]
edition = "2018"
edition = "2021"
publish = false
license = "MIT"

Expand Down
8 changes: 6 additions & 2 deletions src/utils/telemetry-stats/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
name = "onefuzz-telemetry-stats"
version = "0.1.0"
authors = ["<fuzzing@microsoft.com>"]
edition = "2018"
edition = "2021"
license = "MIT"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
anyhow = "1.0"
chrono = { version = "0.4", default-features = false, features = ["clock", "std", "serde"] }
chrono = { version = "0.4", default-features = false, features = [
"clock",
"std",
"serde",
] }

0 comments on commit 8980988

Please sign in to comment.