tests: use crate assert_matches for stable rust

The assert_matches in std still requres nightly rust.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
This commit is contained in:
Changyuan Lyu 2024-04-24 20:33:54 -07:00 committed by Lencerf
parent 22b4c65b3e
commit 0fa9d8ca61
7 changed files with 14 additions and 5 deletions

7
Cargo.lock generated
View file

@ -15,6 +15,7 @@ dependencies = [
name = "alioth"
version = "0.1.0"
dependencies = [
"assert_matches",
"bitfield",
"bitflags",
"libc",
@ -105,6 +106,12 @@ version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519"
[[package]]
name = "assert_matches"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9"
[[package]]
name = "autocfg"
version = "1.2.0"

View file

@ -12,3 +12,6 @@ log = "0.4"
mio = { version = "0.8.8", features = ["os-poll", "os-ext", "net"] }
rand = "0.8.5"
libc = "0.2.150"
[dev-dependencies]
assert_matches = "1"

View file

@ -156,7 +156,7 @@ impl Vcpu for KvmVcpu {
#[cfg(test)]
mod test {
use std::assert_matches::assert_matches;
use assert_matches::assert_matches;
use std::mem::size_of_val;
use std::ptr::null_mut;

View file

@ -162,7 +162,7 @@ impl Vm for KvmVm {
#[cfg(test)]
mod test {
use std::assert_matches::assert_matches;
use assert_matches::assert_matches;
use std::ptr::null_mut;
use libc::{mmap, MAP_ANONYMOUS, MAP_FAILED, MAP_PRIVATE, PROT_EXEC, PROT_READ, PROT_WRITE};

View file

@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(assert_matches)]
#![feature(error_generic_member_access)]
#![feature(pointer_is_aligned)]

View file

@ -181,7 +181,7 @@ where
#[cfg(test)]
mod test {
use std::assert_matches::assert_matches;
use assert_matches::assert_matches;
use super::*;

View file

@ -560,7 +560,7 @@ impl RamBus {
#[cfg(test)]
mod test {
use std::assert_matches::assert_matches;
use assert_matches::assert_matches;
use std::io::{Read, Write};
use std::mem::size_of;
use std::ptr::null_mut;