From 20696bf08ba45c8f641d20d38ee1c8c83cb06ddb Mon Sep 17 00:00:00 2001 From: Carolyn Zech Date: Thu, 19 Sep 2024 10:35:08 -0400 Subject: [PATCH] fix unused imports --- library/contracts/safety/src/lib.rs | 7 +++---- library/core/src/alloc/layout.rs | 4 +++- library/core/src/ptr/alignment.rs | 5 ++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/library/contracts/safety/src/lib.rs b/library/contracts/safety/src/lib.rs index 3114c2cdee37a..60b33f079ce7c 100644 --- a/library/contracts/safety/src/lib.rs +++ b/library/contracts/safety/src/lib.rs @@ -3,9 +3,8 @@ use proc_macro::TokenStream; use proc_macro_error::proc_macro_error; -use syn::{Fields, ItemStruct, parse_macro_input}; -use syn::spanned::Spanned; -use quote::{quote, quote_spanned}; +use syn::{ItemStruct, parse_macro_input}; +use quote::quote; #[cfg(kani_host)] #[path = "kani.rs"] @@ -20,7 +19,7 @@ mod tool; pub fn invariant(attr: TokenStream, item: TokenStream) -> TokenStream { let safe_body = proc_macro2::TokenStream::from(attr); let item = parse_macro_input!(item as ItemStruct); - let mut item_name = &item.ident; + let item_name = &item.ident; let (impl_generics, ty_generics, where_clause) = item.generics.split_for_impl(); let expanded = quote! { diff --git a/library/core/src/alloc/layout.rs b/library/core/src/alloc/layout.rs index 9502a1c66437a..3d10ee2053daa 100644 --- a/library/core/src/alloc/layout.rs +++ b/library/core/src/alloc/layout.rs @@ -8,11 +8,13 @@ use safety::{invariant, requires}; use crate::error::Error; use crate::ptr::{Alignment, NonNull}; use crate::{assert_unsafe_precondition, cmp, fmt, mem}; -use crate::ub_checks::Invariant; #[cfg(kani)] use crate::kani; +#[cfg(kani)] +use crate::ub_checks::Invariant; + // While this function is used in one place and its implementation // could be inlined, the previous attempts to do so made rustc // slower: diff --git a/library/core/src/ptr/alignment.rs b/library/core/src/ptr/alignment.rs index 7782651f8a612..1c4eacb09e1bc 100644 --- a/library/core/src/ptr/alignment.rs +++ b/library/core/src/ptr/alignment.rs @@ -1,11 +1,14 @@ use safety::{ensures, invariant, requires}; use crate::num::NonZero; -use crate::ub_checks::{assert_unsafe_precondition, Invariant}; +use crate::ub_checks::assert_unsafe_precondition; use crate::{cmp, fmt, hash, mem, num}; #[cfg(kani)] use crate::kani; +#[cfg(kani)] +use crate::ub_checks::Invariant; + /// A type storing a `usize` which is a power of two, and thus /// represents a possible alignment in the Rust abstract machine. ///