Skip to content

Commit

Permalink
Clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasAlaif committed Jul 10, 2023
1 parent afb7010 commit c84ec6c
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jni-gen/systest/tests/jvm_builtin_classes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn string_to_jobject<'a>(env: &JNIEnv<'a>, string: &str) -> JNIResult<JObject<'a
Ok(JObject::from(env.new_string(string.to_owned())?))
}

fn jobject_to_string<'a>(env: &JNIEnv<'a>, obj: JObject) -> JNIResult<String> {
fn jobject_to_string(env: &JNIEnv<'_>, obj: JObject) -> JNIResult<String> {
Ok(String::from(env.get_string(JString::from(obj))?))
}

Expand Down
4 changes: 2 additions & 2 deletions prusti-contracts/prusti-contracts-proc-macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prusti-contracts-proc-macros"
version = "0.1.8"
version = "0.1.9"
authors = ["Prusti Devs <prusti_developers@sympa.ethz.ch>"]
edition = "2021"
license = "MPL-2.0"
Expand All @@ -15,7 +15,7 @@ categories = ["development-tools", "development-tools::testing"]
proc-macro = true

[dependencies]
prusti-specs = { path = "../prusti-specs", version = "0.1.8", optional = true }
prusti-specs = { path = "../prusti-specs", version = "0.1.9", optional = true }
proc-macro2 = { version = "1.0", optional = true }

[features]
Expand Down
4 changes: 2 additions & 2 deletions prusti-contracts/prusti-contracts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prusti-contracts"
version = "0.1.8"
version = "0.1.9"
authors = ["Prusti Devs <prusti_developers@sympa.ethz.ch>"]
edition = "2021"
license = "MPL-2.0"
Expand All @@ -12,7 +12,7 @@ keywords = ["prusti", "contracts", "verification", "formal", "specifications"]
categories = ["development-tools", "development-tools::testing"]

[dependencies]
prusti-contracts-proc-macros = { path = "../prusti-contracts-proc-macros", version = "0.1.8" }
prusti-contracts-proc-macros = { path = "../prusti-contracts-proc-macros", version = "0.1.9" }

[dev-dependencies]
trybuild = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion prusti-contracts/prusti-specs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prusti-specs"
version = "0.1.8"
version = "0.1.9"
authors = ["Prusti Devs <prusti_developers@sympa.ethz.ch>"]
edition = "2021"
license = "MPL-2.0"
Expand Down
28 changes: 14 additions & 14 deletions prusti-contracts/prusti-specs/src/extern_spec_rewriter/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ mod tests {

#[test]
fn generated_struct() {
let mut inp_impl: syn::ItemImpl = parse_quote!(
let inp_impl: syn::ItemImpl = parse_quote!(
impl<'a, const CONST: i32, T> MyStruct<'a, CONST, T> {}
);

let rewritten = rewrite_extern_spec_internal(&mut inp_impl).unwrap();
let rewritten = rewrite_extern_spec_internal(&inp_impl).unwrap();

let struct_ident = &rewritten.generated_struct.ident;
let expected: syn::ItemStruct = parse_quote! {
Expand All @@ -212,15 +212,15 @@ mod tests {

#[test]
fn impl_no_generics() {
let mut inp_impl: syn::ItemImpl = parse_quote!(
let inp_impl: syn::ItemImpl = parse_quote!(
impl MyStruct {
fn foo(&self);
fn bar(&mut self);
fn baz(self);
}
);

let rewritten = rewrite_extern_spec_internal(&mut inp_impl).unwrap();
let rewritten = rewrite_extern_spec_internal(&inp_impl).unwrap();

let newtype_ident = &rewritten.generated_struct.ident;
let expected: syn::ItemImpl = parse_quote! {
Expand Down Expand Up @@ -251,13 +251,13 @@ mod tests {

#[test]
fn impl_generics() {
let mut inp_impl: syn::ItemImpl = parse_quote!(
let inp_impl: syn::ItemImpl = parse_quote!(
impl<I, O> MyStruct<I, O, i32> {
fn foo(&self, arg1: I, arg2: i32) -> O;
}
);

let rewritten = rewrite_extern_spec_internal(&mut inp_impl).unwrap();
let rewritten = rewrite_extern_spec_internal(&inp_impl).unwrap();

let newtype_ident = &rewritten.generated_struct.ident;
let expected: syn::ItemImpl = parse_quote! {
Expand All @@ -276,13 +276,13 @@ mod tests {

#[test]
fn impl_forwarded_generics() {
let mut inp_impl: syn::ItemImpl = parse_quote!(
let inp_impl: syn::ItemImpl = parse_quote!(
impl MyStruct {
fn foo<T: Copy>(&self) -> bool;
}
);

let rewritten = rewrite_extern_spec_internal(&mut inp_impl).unwrap();
let rewritten = rewrite_extern_spec_internal(&inp_impl).unwrap();

let newtype_ident = &rewritten.generated_struct.ident;
let expected: syn::ItemImpl = parse_quote! {
Expand All @@ -305,13 +305,13 @@ mod tests {

#[test]
fn associated_types() {
let mut inp_impl: syn::ItemImpl = parse_quote!(
let inp_impl: syn::ItemImpl = parse_quote!(
impl MyTrait for MyStruct {
fn foo(&mut self) -> Self::Result;
}
);

let rewritten = rewrite_extern_spec_internal(&mut inp_impl).unwrap();
let rewritten = rewrite_extern_spec_internal(&inp_impl).unwrap();

let newtype_ident = &rewritten.generated_struct.ident;
let expected_impl: syn::ItemImpl = parse_quote! {
Expand All @@ -330,13 +330,13 @@ mod tests {

#[test]
fn generic_trait() {
let mut inp_impl: syn::ItemImpl = parse_quote!(
let inp_impl: syn::ItemImpl = parse_quote!(
impl MyTrait<Foo> for MyStruct {
fn foo(&mut self, arg1: Foo);
}
);

let rewritten = rewrite_extern_spec_internal(&mut inp_impl).unwrap();
let rewritten = rewrite_extern_spec_internal(&inp_impl).unwrap();

let newtype_ident = &rewritten.generated_struct.ident;
let expected_impl: syn::ItemImpl = parse_quote! {
Expand All @@ -355,13 +355,13 @@ mod tests {

#[test]
fn generic_blanket_impl() {
let mut inp_impl: syn::ItemImpl = parse_quote!(
let inp_impl: syn::ItemImpl = parse_quote!(
impl<I> MyTrait<I> for MyStruct {
fn foo(&mut self, arg1: I);
}
);

let rewritten = rewrite_extern_spec_internal(&mut inp_impl).unwrap();
let rewritten = rewrite_extern_spec_internal(&inp_impl).unwrap();

let newtype_ident = &rewritten.generated_struct.ident;
let expected_impl: syn::ItemImpl = parse_quote! {
Expand Down
4 changes: 2 additions & 2 deletions prusti-contracts/prusti-std/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prusti-std"
version = "0.1.8"
version = "0.1.9"
authors = ["Prusti Devs <prusti_developers@sympa.ethz.ch>"]
edition = "2021"
license = "MPL-2.0"
Expand All @@ -12,7 +12,7 @@ keywords = ["prusti", "contracts", "verification", "formal", "specifications"]
categories = ["development-tools", "development-tools::testing"]

[dependencies]
prusti-contracts = { path = "../prusti-contracts", version = "0.1.8" }
prusti-contracts = { path = "../prusti-contracts", version = "0.1.9" }

# Forward "prusti" flag
[features]
Expand Down
2 changes: 1 addition & 1 deletion prusti-interface/src/environment/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl<'tcx> EnvBody<'tcx> {

let facts = BorrowckFacts {
input_facts: RefCell::new(body_with_facts.input_facts.map(|f| *f)),
output_facts: body_with_facts.output_facts.unwrap(),
output_facts: body_with_facts.output_facts,
location_table: RefCell::new(body_with_facts.location_table),
};

Expand Down
2 changes: 1 addition & 1 deletion prusti-interface/src/environment/borrowck/facts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct BorrowckFacts {
/// Polonius input facts.
pub input_facts: RefCell<Option<AllInputFacts>>,
/// Polonius output facts.
pub output_facts: Rc<AllOutputFacts>,
pub output_facts: Option<Rc<AllOutputFacts>>,
/// The table that maps Polonius points to locations in the table.
pub location_table: RefCell<Option<LocationTable>>,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ impl IntoSnapshot for vir_mid::Type {
&self,
lowerer: &mut Lowerer<'p, 'v, 'tcx>,
) -> SpannedEncodingResult<Self::Target> {
ContextIndependentSnapshot::default().type_to_snapshot(lowerer, self)
ContextIndependentSnapshot.type_to_snapshot(lowerer, self)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ where
let fields = self.move_paths_for_fields(
self.place,
self.path,
&adt.variant(FIRST_VARIANT),
adt.variant(FIRST_VARIANT),
substs,
);
self.drop_ladder(fields, succ, unwind)
Expand Down Expand Up @@ -502,7 +502,7 @@ where
self.place,
ProjectionElem::Downcast(Some(variant.name), variant_index),
);
let fields = self.move_paths_for_fields(base_place, variant_path, &variant, substs);
let fields = self.move_paths_for_fields(base_place, variant_path, variant, substs);
values.push(discr.val);
if let Unwind::To(unwind) = unwind {
// We can't use the half-ladder from the original
Expand Down Expand Up @@ -683,8 +683,8 @@ where
ety: Ty<'tcx>,
unwind: Unwind,
) -> BasicBlock {
let copy = |place: Place<'tcx>| Operand::Copy(place);
let move_ = |place: Place<'tcx>| Operand::Move(place);
let copy = Operand::Copy;
let move_ = Operand::Move;
let tcx = self.tcx();

let ptr_ty = tcx.mk_ptr(ty::TypeAndMut {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub(in super::super) fn run_pass<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>)
}
};
let un_derefer = UnDerefer {
tcx: tcx,
tcx,
derefer_sidetable: side_table,
};
let elaborate_patch = {
Expand Down Expand Up @@ -110,7 +110,7 @@ pub(in super::super) fn run_pass<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>)
init_data: InitializationData { inits, uninits },
drop_flags,
patch: MirPatch::new(body),
un_derefer: un_derefer,
un_derefer,
reachable,
}
.elaborate()
Expand All @@ -130,7 +130,7 @@ pub(in super::super) fn remove_dead_unwinds<'tcx>(
// We only need to do this pass once, because unwind edges can only
// reach cleanup blocks, which can't have unwind edges themselves.
let mut dead_unwinds = Vec::new();
let mut flow_inits = MaybeInitializedPlaces::new(tcx, body, &env)
let mut flow_inits = MaybeInitializedPlaces::new(tcx, body, env)
.into_engine(tcx, body)
.pass_name("remove_dead_unwinds")
.iterate_to_fixpoint()
Expand Down Expand Up @@ -162,7 +162,7 @@ pub(in super::super) fn remove_dead_unwinds<'tcx>(
);

let mut maybe_live = false;
on_all_drop_children_bits(tcx, body, &env, path, |child| {
on_all_drop_children_bits(tcx, body, env, path, |child| {
maybe_live |= flow_inits.contains(child);
});

Expand Down
2 changes: 1 addition & 1 deletion prusti-viper/src/encoder/mir/procedures/encoder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> {
assert!(ty.is_union());
let adt_def = tcx.adt_def(*adt_did);
let variant_def = adt_def.non_enum_variant();
let field_name = variant_def.fields[(*active_field_index).into()]
let field_name = variant_def.fields[*active_field_index]
.ident(tcx)
.to_string();
ty = ty.variant(field_name.into());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ where
.collect();

// Interpret all the blocks in `pending_blocks`
while !pending_blocks.is_empty() {
let curr_bb = pending_blocks.pop().unwrap();
while let Some(curr_bb) = pending_blocks.pop() {

let bb_data = &basic_blocks[curr_bb];

// Apply the terminator
Expand Down Expand Up @@ -126,8 +126,8 @@ pub fn run_backward_interpretation_point_to_point<
let mut pending_blocks: Vec<mir::BasicBlock> = vec![final_bbi];

// Interpret all the blocks in `pending_blocks`
while !pending_blocks.is_empty() {
let curr_bb = pending_blocks.pop().unwrap();
while let Some(curr_bb) = pending_blocks.pop() {

let bb_data = &basic_blocks[curr_bb];
trace!("curr_bb: {:?}", curr_bb);

Expand Down
2 changes: 1 addition & 1 deletion prusti-viper/src/encoder/procedure_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6009,7 +6009,7 @@ impl<'p, 'v: 'p, 'tcx: 'v> ProcedureEncoder<'p, 'v, 'tcx> {
mir::NullOp::AlignOf => layout.align().abi.bytes(),
mir::NullOp::OffsetOf(_) => {
return Err(SpannedEncodingError::internal(
format!("`OffsetOf` is not supported yet"),
"`OffsetOf` is not supported yet".to_string(),
self.mir.source_info(location).span,
))
}
Expand Down
6 changes: 3 additions & 3 deletions prusti/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ fn report_prusti_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) {

let xs: Vec<String> = vec![
"Prusti or the compiler unexpectedly panicked. This is a bug.".into(),
format!("We would appreciate a bug report: {bug_report_url}").into(),
format!("Prusti version: {version_info}").into(),
format!("We would appreciate a bug report: {bug_report_url}"),
format!("Prusti version: {version_info}"),
];

for note in xs {
Expand Down Expand Up @@ -244,7 +244,7 @@ fn main() {
));
}

let mut callbacks = PrustiCompilerCalls::default();
let mut callbacks = PrustiCompilerCalls;

prusti_rustc_interface::driver::RunCompiler::new(&rustc_args, &mut callbacks).run()
});
Expand Down

0 comments on commit c84ec6c

Please sign in to comment.