2019-11-16 17:43:18 +00:00
|
|
|
Given rust:
|
|
|
|
fn main() {
|
|
|
|
let a = 2;
|
|
|
|
println!("Hello World\n")
|
|
|
|
}
|
|
|
|
|
|
|
|
Do:
|
|
|
|
vip=
|
|
|
|
|
|
|
|
Expect rust (very basic indentation result):
|
|
|
|
fn main() {
|
|
|
|
let a = 2;
|
|
|
|
println!("Hello World\n")
|
|
|
|
}
|
|
|
|
|
|
|
|
############################################
|
|
|
|
# Issue #195
|
|
|
|
|
|
|
|
Given rust:
|
|
|
|
fn main() {
|
|
|
|
let paths: Vec<_> = ({
|
|
|
|
fs::read_dir("test_data")
|
|
|
|
.unwrap()
|
|
|
|
.cloned()
|
|
|
|
})
|
|
|
|
.collect();
|
|
|
|
|
|
|
|
println!("Hello World\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
Do:
|
|
|
|
/collect\<cr>
|
|
|
|
ostatement();\<ESC>\<ESC>
|
|
|
|
|
|
|
|
Expect rust (issue #195):
|
|
|
|
fn main() {
|
|
|
|
let paths: Vec<_> = ({
|
|
|
|
fs::read_dir("test_data")
|
|
|
|
.unwrap()
|
|
|
|
.cloned()
|
|
|
|
})
|
|
|
|
.collect();
|
|
|
|
statement();
|
|
|
|
|
|
|
|
println!("Hello World\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
############################################
|
|
|
|
# Issue #189
|
|
|
|
|
|
|
|
Given rust:
|
|
|
|
impl X for {
|
|
|
|
pub fn get<Q>(&self, key: &Q) -> Option<Entry<K, V>>
|
|
|
|
where
|
|
|
|
K: Borrow<Q>,
|
|
|
|
Q: Ord + ?Sized,
|
|
|
|
{
|
|
|
|
self.inner.get(key).map(Entry::new)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Do:
|
|
|
|
vip=
|
|
|
|
|
|
|
|
Expect rust (issue #189):
|
|
|
|
impl X for {
|
|
|
|
pub fn get<Q>(&self, key: &Q) -> Option<Entry<K, V>>
|
|
|
|
where
|
|
|
|
K: Borrow<Q>,
|
|
|
|
Q: Ord + ?Sized,
|
|
|
|
{
|
|
|
|
self.inner.get(key).map(Entry::new)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
############################################
|
|
|
|
# Issue #189b
|
|
|
|
|
|
|
|
Given rust:
|
|
|
|
impl X for {
|
|
|
|
pub fn get<Q>(&self, key: &Q) -> Option<Entry<K, V>>
|
|
|
|
where
|
|
|
|
K: Borrow<Q>,
|
|
|
|
Q: Ord + ?Sized
|
|
|
|
{
|
|
|
|
self.inner.get(key).map(Entry::new)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Do:
|
|
|
|
vip=
|
|
|
|
|
|
|
|
Expect rust (issue #189b):
|
|
|
|
impl X for {
|
|
|
|
pub fn get<Q>(&self, key: &Q) -> Option<Entry<K, V>>
|
|
|
|
where
|
|
|
|
K: Borrow<Q>,
|
|
|
|
Q: Ord + ?Sized
|
|
|
|
{
|
|
|
|
self.inner.get(key).map(Entry::new)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
############################################
|
|
|
|
# Issue #189c
|
|
|
|
|
|
|
|
Given rust:
|
|
|
|
impl X for {
|
|
|
|
pub fn get<Q>(&self, key: &Q) -> Option<Entry<K, V>>
|
|
|
|
where K: Borrow<Q>, Q: Ord + ?Sized
|
|
|
|
{
|
|
|
|
self.inner.get(key).map(Entry::new)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Do:
|
|
|
|
vip=
|
|
|
|
|
|
|
|
Expect rust (issue #189b):
|
|
|
|
impl X for {
|
|
|
|
pub fn get<Q>(&self, key: &Q) -> Option<Entry<K, V>>
|
|
|
|
where K: Borrow<Q>, Q: Ord + ?Sized
|
|
|
|
{
|
|
|
|
self.inner.get(key).map(Entry::new)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
############################################
|
|
|
|
# Issue #149
|
|
|
|
|
|
|
|
Given rust:
|
|
|
|
fn test() {
|
|
|
|
let t = "a
|
|
|
|
wah";
|
|
|
|
}
|
|
|
|
|
|
|
|
Do:
|
|
|
|
/wah\<cr>
|
|
|
|
i#\<ESC>\<ESC>
|
|
|
|
/;\<cr>o
|
|
|
|
statement();\<ESC>\<ESC>
|
|
|
|
|
|
|
|
# Disabled
|
|
|
|
# Expect rust (issue #149):
|
|
|
|
fn test() {
|
|
|
|
let t = "a
|
|
|
|
#wah";
|
|
|
|
statement();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
############################################
|
|
|
|
# Issue #77
|
|
|
|
|
|
|
|
Given rust:
|
|
|
|
fn test() {
|
|
|
|
}
|
|
|
|
|
|
|
|
Do:
|
|
|
|
of(x, y,\<CR>z);\<CR>
|
|
|
|
f((x, y),\<CR>z);\<CR>
|
|
|
|
|
|
|
|
# Disabled
|
|
|
|
# Expect rust (issue #77):
|
|
|
|
fn test() {
|
|
|
|
f(x, y,
|
|
|
|
z);
|
|
|
|
f((x, y),
|
|
|
|
z);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
############################################
|
|
|
|
# Issue #44
|
|
|
|
|
|
|
|
Given rust:
|
|
|
|
fn main() {
|
|
|
|
a
|
|
|
|
|
|
|
|
let philosophers = vec![
|
|
|
|
Philosopher::new("Judith Butler"),
|
|
|
|
Philosopher::new("Gilles Deleuze"),
|
|
|
|
Philosopher::new("Karl Marx"),
|
|
|
|
Philosopher::new("Emma Goldman"),
|
|
|
|
Philosopher::new("Michel Foucault"),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
Do:
|
|
|
|
/let\<CR>
|
|
|
|
vip=
|
|
|
|
|
|
|
|
# Disabled
|
|
|
|
# Expect rust (issue #44):
|
|
|
|
fn main() {
|
|
|
|
a
|
|
|
|
|
|
|
|
let philosophers = vec![
|
|
|
|
Philosopher::new("Judith Butler"),
|
|
|
|
Philosopher::new("Gilles Deleuze"),
|
|
|
|
Philosopher::new("Karl Marx"),
|
|
|
|
Philosopher::new("Emma Goldman"),
|
|
|
|
Philosopher::new("Michel Foucault"),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
############################################
|
|
|
|
# Issue #5
|
|
|
|
|
|
|
|
Given rust:
|
|
|
|
fn f() {
|
|
|
|
if x &&
|
|
|
|
y {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Do:
|
|
|
|
vip=
|
|
|
|
|
|
|
|
Expect rust (issue #5):
|
|
|
|
fn f() {
|
|
|
|
if x &&
|
|
|
|
y {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-30 12:06:56 +00:00
|
|
|
############################################
|
|
|
|
# Issue #366
|
|
|
|
|
|
|
|
Given rust:
|
|
|
|
fn f() {
|
|
|
|
g(|_| {
|
|
|
|
h();
|
|
|
|
})
|
|
|
|
.unwrap();
|
|
|
|
h();
|
|
|
|
}
|
|
|
|
|
|
|
|
Do:
|
|
|
|
vip=
|
|
|
|
|
|
|
|
Expect rust (issue #366):
|
|
|
|
fn f() {
|
|
|
|
g(|_| {
|
|
|
|
h();
|
|
|
|
})
|
|
|
|
.unwrap();
|
|
|
|
h();
|
|
|
|
}
|
|
|
|
|
|
|
|
Given rust:
|
|
|
|
fn f() {
|
|
|
|
let a = g(|_| {
|
|
|
|
h();
|
|
|
|
})
|
|
|
|
.unwrap();
|
|
|
|
h();
|
|
|
|
}
|
|
|
|
|
|
|
|
Do:
|
|
|
|
vip=
|
|
|
|
|
|
|
|
Expect rust (issue #366, variation #2):
|
|
|
|
fn f() {
|
|
|
|
let a = g(|_| {
|
|
|
|
h();
|
|
|
|
})
|
|
|
|
.unwrap();
|
|
|
|
h();
|
|
|
|
}
|
|
|
|
|
2019-11-16 17:43:18 +00:00
|
|
|
############################################
|
|
|
|
|
|
|
|
Given rust:
|
|
|
|
fn f() {
|
|
|
|
let mut state = State::new(
|
|
|
|
backend,
|
|
|
|
header.clone(),
|
|
|
|
).expect("Something");
|
|
|
|
}
|
|
|
|
|
|
|
|
Do:
|
|
|
|
vip=
|
|
|
|
|
|
|
|
Expect rust (Trailing comma in call):
|
|
|
|
fn f() {
|
|
|
|
let mut state = State::new(
|
|
|
|
backend,
|
|
|
|
header.clone(),
|
|
|
|
).expect("Something");
|
|
|
|
}
|