Bump to Rust 1.63 (#2243)

* Bump to Rust 1.63

* Fix clippy warnings

* Suppress clippy warning

* More clippy fixes

* Print cargo-license version

* Ignore unmaintained warning

* Pin cargo-license to 0.4.2, 0.5 breaks us

* Suppress in proxy build as well

* More Eqs

* More clippy fixes
This commit is contained in:
George Pollard
2022-08-16 01:39:32 +12:00
committed by GitHub
parent 023a31fee3
commit dcb3096d79
17 changed files with 28 additions and 22 deletions

View File

@ -18,7 +18,7 @@ sudo npm install -g azurite
# Restore rust dependencies # Restore rust dependencies
echo "Restoring rust dependencies" echo "Restoring rust dependencies"
cargo install cargo-audit cargo-license # requirements if you want to run ci/agent.sh cargo install cargo-audit cargo-license@0.4.2 # requirements if you want to run ci/agent.sh
cd /workspaces/onefuzz/src/agent cd /workspaces/onefuzz/src/agent
cargo fetch cargo fetch

View File

@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install specific Rust version - name: Install specific Rust version
run: | run: |
rustup default 1.62 rustup default 1.63
rustup component add clippy rustfmt rustup component add clippy rustfmt
- name: Get Rust version & build version - name: Get Rust version & build version
shell: bash shell: bash

View File

@ -81,7 +81,7 @@ fn input_command(argv: &[String], input: &Path) -> Command {
let args: Vec<_> = argv[1..] let args: Vec<_> = argv[1..]
.iter() .iter()
.map(|a| { .map(|a| {
if &*a == "@@" { if a == "@@" {
input.display().to_string() input.display().to_string()
} else { } else {
a.to_string() a.to_string()

View File

@ -80,7 +80,7 @@ fn input_command(argv: &[String], input: &Path) -> Command {
let args: Vec<_> = argv[1..] let args: Vec<_> = argv[1..]
.iter() .iter()
.map(|a| { .map(|a| {
if &*a == "@@" { if a == "@@" {
input.display().to_string() input.display().to_string()
} else { } else {
a.to_string() a.to_string()

View File

@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
/// ///
/// Coverage is reported as a sequence of module coverage entries, which are /// Coverage is reported as a sequence of module coverage entries, which are
/// generic in a coverage type `C` and a metadata type `M`. /// generic in a coverage type `C` and a metadata type `M`.
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq, Serialize)]
#[serde(transparent)] #[serde(transparent)]
pub struct CoverageReport<C, M> { pub struct CoverageReport<C, M> {
/// Coverage data for each module. /// Coverage data for each module.
@ -29,7 +29,7 @@ pub struct CoverageReport<C, M> {
/// ///
/// Warning: `serde` allows duplicate keys. If `M` and `C` share field names as /// Warning: `serde` allows duplicate keys. If `M` and `C` share field names as
/// structs, then the serialized entry will have duplicate keys. /// structs, then the serialized entry will have duplicate keys.
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)] #[derive(Clone, Debug, Default, Deserialize, PartialEq, Eq, Serialize)]
pub struct CoverageReportEntry<C, M> { pub struct CoverageReportEntry<C, M> {
/// Path or name of the module. /// Path or name of the module.
pub module: String, pub module: String,

View File

@ -418,7 +418,7 @@ impl ModuleInfo {
} }
} }
#[derive(Clone, Debug, Hash, PartialEq)] #[derive(Clone, Debug, Hash, PartialEq, Eq)]
pub struct SymInfo { pub struct SymInfo {
pub symbol: String, pub symbol: String,
pub address: u64, pub address: u64,

View File

@ -168,7 +168,7 @@ impl Module {
} }
} }
#[derive(Copy, Clone, Debug, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Machine { pub enum Machine {
Unknown, Unknown,
X64, X64,

View File

@ -18,7 +18,7 @@ use crate::dbghelp::{self, DebugHelpGuard, ModuleInfo, SymInfo, SymLineInfo};
const UNKNOWN_MODULE: &str = "<UnknownModule>"; const UNKNOWN_MODULE: &str = "<UnknownModule>";
/// The file and line number for frames in the call stack. /// The file and line number for frames in the call stack.
#[derive(Clone, Debug, Hash, PartialEq)] #[derive(Clone, Debug, Hash, PartialEq, Eq)]
pub struct FileInfo { pub struct FileInfo {
pub file: String, pub file: String,
pub line: u32, pub line: u32,
@ -38,7 +38,7 @@ impl From<&SymLineInfo> for FileInfo {
} }
} }
#[derive(Clone, Debug, Hash, PartialEq)] #[derive(Clone, Debug, Hash, PartialEq, Eq)]
pub enum DebugStackFrame { pub enum DebugStackFrame {
Frame { Frame {
module_name: String, module_name: String,
@ -118,7 +118,7 @@ impl Serialize for DebugStackFrame {
} }
} }
#[derive(Debug, PartialEq, Serialize)] #[derive(Debug, PartialEq, Serialize, Eq)]
pub struct DebugStack { pub struct DebugStack {
pub frames: Vec<DebugStackFrame>, pub frames: Vec<DebugStackFrame>,
} }

View File

@ -148,7 +148,7 @@ impl ThreadInfo {
} }
} }
#[derive(Copy, Clone, PartialEq)] #[derive(Copy, Clone, PartialEq, Eq)]
enum SymInitalizeState { enum SymInitalizeState {
NotInitialized, NotInitialized,
InitializeNeeded, InitializeNeeded,

View File

@ -882,7 +882,7 @@ impl ArgsWithComments {
} }
} }
#[derive(Clone, Copy, Debug, PartialEq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum AppVerifierState { pub enum AppVerifierState {
Enabled, Enabled,
Disabled, Disabled,
@ -906,7 +906,7 @@ impl AppVerifierController {
for test in app_verifier_tests.iter() { for test in app_verifier_tests.iter() {
enable_args.arg(format!("{}", test)); enable_args.arg(format!("{}", test));
for stop_code in stop_codes(AppVerifierTest::from_str(&*test)?) { for stop_code in stop_codes(AppVerifierTest::from_str(test)?) {
configure_args.arg(format!("0x{:x}", *stop_code)); configure_args.arg(format!("0x{:x}", *stop_code));
} }
} }

View File

@ -234,7 +234,7 @@ impl fmt::Display for Exception {
} }
/// How did the program exit - normally (so we have a proper exit code) or was it terminated? /// How did the program exit - normally (so we have a proper exit code) or was it terminated?
#[derive(Copy, Clone, Debug, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum ExitStatus { pub enum ExitStatus {
/// The exit code returned from the process. /// The exit code returned from the process.
Code(i32), Code(i32),

View File

@ -14,9 +14,11 @@ pub enum ExpandedValue<'a> {
Path(String), Path(String),
Scalar(String), Scalar(String),
List(&'a [String]), List(&'a [String]),
Mapping(Box<dyn Fn(&Expand<'a>, &str) -> Result<Option<ExpandedValue<'a>>> + Send>), Mapping(MappingFn<'a>),
} }
type MappingFn<'a> = Box<dyn Fn(&Expand<'a>, &str) -> Result<Option<ExpandedValue<'a>>> + Send>;
#[derive(PartialEq, Eq, Hash, EnumIter)] #[derive(PartialEq, Eq, Hash, EnumIter)]
pub enum PlaceHolder { pub enum PlaceHolder {
Input, Input,

View File

@ -174,6 +174,7 @@ mod tests {
} }
#[test] #[test]
#[allow(clippy::read_zero_byte_vec)]
fn read_empty_pipe() { fn read_empty_pipe() {
let (reader, _writer) = pipe().unwrap(); let (reader, _writer) = pipe().unwrap();
let mut buf = vec![]; let mut buf = vec![];

View File

@ -38,6 +38,7 @@ cargo --version
cargo audit --version cargo audit --version
cargo clippy --version cargo clippy --version
cargo fmt --version cargo fmt --version
cargo-license --version
# unless we're doing incremental builds, start clean during CI # unless we're doing incremental builds, start clean during CI
if [ X${CARGO_INCREMENTAL} == X ]; then if [ X${CARGO_INCREMENTAL} == X ]; then
@ -52,7 +53,8 @@ cargo fmt -- --check
# RUSTSEC-2020-0077: `memmap` dependency unmaintained, via `symbolic` (see: `getsentry/symbolic#304`) # RUSTSEC-2020-0077: `memmap` dependency unmaintained, via `symbolic` (see: `getsentry/symbolic#304`)
# RUSTSEC-2020-0159: potential segfault in `time`, not yet patched (#1366) # RUSTSEC-2020-0159: potential segfault in `time`, not yet patched (#1366)
# RUSTSEC-2020-0071: potential segfault in `chrono`, not yet patched (#1366) # RUSTSEC-2020-0071: potential segfault in `chrono`, not yet patched (#1366)
cargo audit --deny warnings --deny unmaintained --deny unsound --deny yanked --ignore RUSTSEC-2020-0016 --ignore RUSTSEC-2020-0036 --ignore RUSTSEC-2019-0036 --ignore RUSTSEC-2021-0065 --ignore RUSTSEC-2020-0159 --ignore RUSTSEC-2020-0071 --ignore RUSTSEC-2020-0077 # RUSTSEC-2022-0048: xml-rs is unmaintained
cargo audit --deny warnings --deny unmaintained --deny unsound --deny yanked --ignore RUSTSEC-2020-0016 --ignore RUSTSEC-2020-0036 --ignore RUSTSEC-2019-0036 --ignore RUSTSEC-2021-0065 --ignore RUSTSEC-2020-0159 --ignore RUSTSEC-2020-0071 --ignore RUSTSEC-2020-0077 --ignore RUSTSEC-2022-0048
cargo-license -j > data/licenses.json cargo-license -j > data/licenses.json
cargo build --release --locked cargo build --release --locked
cargo clippy --release --locked --all-targets -- -D warnings cargo clippy --release --locked --all-targets -- -D warnings

View File

@ -16,7 +16,8 @@ cargo clippy --release --all-targets -- -D warnings
# RUSTSEC-2021-0065: a dependency `anymap` is no longer supported # RUSTSEC-2021-0065: a dependency `anymap` is no longer supported
# RUSTSEC-2020-0159: potential segfault in `time`, not yet patched (#1366) # RUSTSEC-2020-0159: potential segfault in `time`, not yet patched (#1366)
# RUSTSEC-2020-0071: potential segfault in `chrono`, not yet patched (#1366) # RUSTSEC-2020-0071: potential segfault in `chrono`, not yet patched (#1366)
cargo audit --deny warnings --deny unmaintained --deny unsound --deny yanked --ignore RUSTSEC-2020-0016 --ignore RUSTSEC-2021-0065 --ignore RUSTSEC-2020-0159 --ignore RUSTSEC-2020-0071 # RUSTSEC-2022-0048: xml-rs is unmaintained
cargo audit --deny warnings --deny unmaintained --deny unsound --deny yanked --ignore RUSTSEC-2020-0016 --ignore RUSTSEC-2021-0065 --ignore RUSTSEC-2020-0159 --ignore RUSTSEC-2020-0071 --ignore RUSTSEC-2022-0048
cargo-license -j > data/licenses.json cargo-license -j > data/licenses.json
cargo build --release --locked cargo build --release --locked
# export RUST_LOG=trace # export RUST_LOG=trace

View File

@ -14,5 +14,5 @@ fi
cargo install cargo-audit cargo install cargo-audit
if ! cargo-license --help; then if ! cargo-license --help; then
cargo install cargo-license cargo install cargo-license@0.4.2
fi fi

View File

@ -35,14 +35,14 @@ pub enum ProxyError {
}, },
} }
#[derive(Debug, Deserialize, Serialize, PartialEq, Clone)] #[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone)]
pub struct Forward { pub struct Forward {
pub src_port: u16, pub src_port: u16,
pub dst_ip: String, pub dst_ip: String,
pub dst_port: u16, pub dst_port: u16,
} }
#[derive(Debug, Deserialize, Serialize, PartialEq, Clone)] #[derive(Debug, Deserialize, Serialize, PartialEq, Eq, Clone)]
pub struct ConfigData { pub struct ConfigData {
pub instance_id: Uuid, pub instance_id: Uuid,
pub instance_telemetry_key: Option<InstanceTelemetryKey>, pub instance_telemetry_key: Option<InstanceTelemetryKey>,
@ -54,7 +54,7 @@ pub struct ConfigData {
pub forwards: Vec<Forward>, pub forwards: Vec<Forward>,
} }
#[derive(Debug, Deserialize, Serialize, PartialEq)] #[derive(Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct NotifyResponse<'a> { pub struct NotifyResponse<'a> {
pub region: &'a str, pub region: &'a str,
pub proxy_id: Uuid, pub proxy_id: Uuid,