Skip to content

Commit

Permalink
Remove rest_pat from future work, since it has been addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
parno committed Dec 12, 2023
1 parent e829a70 commit 9abb671
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 3 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ An opinionated formatter for [Verus] code.

## Future Work
- Special handling for commonly used macros, like `println!`, `state_machine!`, `calc!`
- In `record_expr_field_list` and `record_pat_field_list`, handle vanishing comma's interaction with `rest_pat`
- Enforce the [Rust naming policy](https://doc.rust-lang.org/beta/style-guide/advice.html#names)?

## Non-Future Work
Expand Down
75 changes: 73 additions & 2 deletions examples/wip.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,78 @@
use builtin::*;
use builtin_macros::*;
use vstd::map::*;
use vstd::modes::*;
use vstd::multiset::*;
use vstd::pervasive::*;
use vstd::seq::*;
use vstd::set::*;

use crate::abstract_end_point_t::*;
use crate::app_interface_t::*;
use crate::keys_t::*;
use crate::network_t::*;

verus! {

fn test() {
let x = (1,);
/*
This comment absorbes the newline that should separate it from the struct
*/
struct Constants { b: int }


// The first set of &&& get out-dented, while the second one is absorbed into a single line
fn clone_value() -> (out: u8)
ensures
match value {
Some(vec) => {
&&& out.is_Some()
&&& out.unwrap()@ == vec@
},
None => {
&&& out.is_None()
},
},
{
}

// Weird formatting of the constructor in the second case
pub fn clone_up_to_view(&self) -> (c: Self)
ensures
c@ == self@,
{
match self {
CMessage::GetRequest { k } => { CMessage::GetRequest { k: k.clone() } },
CMessage::SetRequest { k, v } => { CMessage::SetRequest { k: k.clone(), v: CMessage::clone_value(v) } },
}
}

// Weird formatting of the return value
pub open spec fn abstractify_outbound_packets_to_seq_of_lsht_packets(packets: Seq<CPacket>) -> Seq<
LSHTPacket,
>
recommends
cpacket_seq_is_abstractable(packets),
{
[]
}

// Weird indenting of the last line
proof fn test() {
assert_seqs_equal!(v@,
old(v)@.subrange(0, start as int) +
old(v)@.subrange(start as int + deleted as int,
old(v)@.len() as int));
}

// Why the extra newline for the semi-colon?
fn test() -> u64 {
proof { assert_sets_equal!(a, b); };
proof {
assert_sets_equal!(a, b);
assert_sets_equal!(c, d);
};
5

}

} // verus!

0 comments on commit 9abb671

Please sign in to comment.