It's fookin' raw

This commit is contained in:
Jonas Schievink 2020-06-15 22:39:26 +02:00
parent 5d66bfe163
commit 71c002e589

View file

@ -152,10 +152,10 @@ mod tests {
fn test_replace_add_use_no_anchor() { fn test_replace_add_use_no_anchor() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
std::fmt::Debug<|> std::fmt::Debug<|>
", ",
" r"
use std::fmt::Debug; use std::fmt::Debug;
Debug Debug
@ -166,13 +166,13 @@ Debug
fn test_replace_add_use_no_anchor_with_item_below() { fn test_replace_add_use_no_anchor_with_item_below() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
std::fmt::Debug<|> std::fmt::Debug<|>
fn main() { fn main() {
} }
", ",
" r"
use std::fmt::Debug; use std::fmt::Debug;
Debug Debug
@ -187,13 +187,13 @@ fn main() {
fn test_replace_add_use_no_anchor_with_item_above() { fn test_replace_add_use_no_anchor_with_item_above() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
fn main() { fn main() {
} }
std::fmt::Debug<|> std::fmt::Debug<|>
", ",
" r"
use std::fmt::Debug; use std::fmt::Debug;
fn main() { fn main() {
@ -208,10 +208,10 @@ Debug
fn test_replace_add_use_no_anchor_2seg() { fn test_replace_add_use_no_anchor_2seg() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
std::fmt<|>::Debug std::fmt<|>::Debug
", ",
" r"
use std::fmt; use std::fmt;
fmt::Debug fmt::Debug
@ -223,13 +223,13 @@ fmt::Debug
fn test_replace_add_use() { fn test_replace_add_use() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
use stdx; use stdx;
impl std::fmt::Debug<|> for Foo { impl std::fmt::Debug<|> for Foo {
} }
", ",
" r"
use stdx; use stdx;
use std::fmt::Debug; use std::fmt::Debug;
@ -243,11 +243,11 @@ impl Debug for Foo {
fn test_replace_file_use_other_anchor() { fn test_replace_file_use_other_anchor() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
impl std::fmt::Debug<|> for Foo { impl std::fmt::Debug<|> for Foo {
} }
", ",
" r"
use std::fmt::Debug; use std::fmt::Debug;
impl Debug for Foo { impl Debug for Foo {
@ -260,11 +260,11 @@ impl Debug for Foo {
fn test_replace_add_use_other_anchor_indent() { fn test_replace_add_use_other_anchor_indent() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
impl std::fmt::Debug<|> for Foo { impl std::fmt::Debug<|> for Foo {
} }
", ",
" r"
use std::fmt::Debug; use std::fmt::Debug;
impl Debug for Foo { impl Debug for Foo {
@ -277,13 +277,13 @@ impl Debug for Foo {
fn test_replace_split_different() { fn test_replace_split_different() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
use std::fmt; use std::fmt;
impl std::io<|> for Foo { impl std::io<|> for Foo {
} }
", ",
" r"
use std::{io, fmt}; use std::{io, fmt};
impl io for Foo { impl io for Foo {
@ -296,13 +296,13 @@ impl io for Foo {
fn test_replace_split_self_for_use() { fn test_replace_split_self_for_use() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
use std::fmt; use std::fmt;
impl std::fmt::Debug<|> for Foo { impl std::fmt::Debug<|> for Foo {
} }
", ",
" r"
use std::fmt::{self, Debug, }; use std::fmt::{self, Debug, };
impl Debug for Foo { impl Debug for Foo {
@ -315,13 +315,13 @@ impl Debug for Foo {
fn test_replace_split_self_for_target() { fn test_replace_split_self_for_target() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
use std::fmt::Debug; use std::fmt::Debug;
impl std::fmt<|> for Foo { impl std::fmt<|> for Foo {
} }
", ",
" r"
use std::fmt::{self, Debug}; use std::fmt::{self, Debug};
impl fmt for Foo { impl fmt for Foo {
@ -334,13 +334,13 @@ impl fmt for Foo {
fn test_replace_add_to_nested_self_nested() { fn test_replace_add_to_nested_self_nested() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
use std::fmt::{Debug, nested::{Display}}; use std::fmt::{Debug, nested::{Display}};
impl std::fmt::nested<|> for Foo { impl std::fmt::nested<|> for Foo {
} }
", ",
" r"
use std::fmt::{Debug, nested::{Display, self}}; use std::fmt::{Debug, nested::{Display, self}};
impl nested for Foo { impl nested for Foo {
@ -353,13 +353,13 @@ impl nested for Foo {
fn test_replace_add_to_nested_self_already_included() { fn test_replace_add_to_nested_self_already_included() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
use std::fmt::{Debug, nested::{self, Display}}; use std::fmt::{Debug, nested::{self, Display}};
impl std::fmt::nested<|> for Foo { impl std::fmt::nested<|> for Foo {
} }
", ",
" r"
use std::fmt::{Debug, nested::{self, Display}}; use std::fmt::{Debug, nested::{self, Display}};
impl nested for Foo { impl nested for Foo {
@ -372,13 +372,13 @@ impl nested for Foo {
fn test_replace_add_to_nested_nested() { fn test_replace_add_to_nested_nested() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
use std::fmt::{Debug, nested::{Display}}; use std::fmt::{Debug, nested::{Display}};
impl std::fmt::nested::Debug<|> for Foo { impl std::fmt::nested::Debug<|> for Foo {
} }
", ",
" r"
use std::fmt::{Debug, nested::{Display, Debug}}; use std::fmt::{Debug, nested::{Display, Debug}};
impl Debug for Foo { impl Debug for Foo {
@ -391,13 +391,13 @@ impl Debug for Foo {
fn test_replace_split_common_target_longer() { fn test_replace_split_common_target_longer() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
use std::fmt::Debug; use std::fmt::Debug;
impl std::fmt::nested::Display<|> for Foo { impl std::fmt::nested::Display<|> for Foo {
} }
", ",
" r"
use std::fmt::{nested::Display, Debug}; use std::fmt::{nested::Display, Debug};
impl Display for Foo { impl Display for Foo {
@ -410,13 +410,13 @@ impl Display for Foo {
fn test_replace_split_common_use_longer() { fn test_replace_split_common_use_longer() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
use std::fmt::nested::Debug; use std::fmt::nested::Debug;
impl std::fmt::Display<|> for Foo { impl std::fmt::Display<|> for Foo {
} }
", ",
" r"
use std::fmt::{Display, nested::Debug}; use std::fmt::{Display, nested::Debug};
impl Display for Foo { impl Display for Foo {
@ -429,7 +429,7 @@ impl Display for Foo {
fn test_replace_use_nested_import() { fn test_replace_use_nested_import() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
use crate::{ use crate::{
ty::{Substs, Ty}, ty::{Substs, Ty},
AssocItem, AssocItem,
@ -437,7 +437,7 @@ use crate::{
fn foo() { crate::ty::lower<|>::trait_env() } fn foo() { crate::ty::lower<|>::trait_env() }
", ",
" r"
use crate::{ use crate::{
ty::{Substs, Ty, lower}, ty::{Substs, Ty, lower},
AssocItem, AssocItem,
@ -452,13 +452,13 @@ fn foo() { lower::trait_env() }
fn test_replace_alias() { fn test_replace_alias() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
use std::fmt as foo; use std::fmt as foo;
impl foo::Debug<|> for Foo { impl foo::Debug<|> for Foo {
} }
", ",
" r"
use std::fmt as foo; use std::fmt as foo;
impl Debug for Foo { impl Debug for Foo {
@ -471,7 +471,7 @@ impl Debug for Foo {
fn test_replace_not_applicable_one_segment() { fn test_replace_not_applicable_one_segment() {
check_assist_not_applicable( check_assist_not_applicable(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
impl foo<|> for Foo { impl foo<|> for Foo {
} }
", ",
@ -482,7 +482,7 @@ impl foo<|> for Foo {
fn test_replace_not_applicable_in_use() { fn test_replace_not_applicable_in_use() {
check_assist_not_applicable( check_assist_not_applicable(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
use std::fmt<|>; use std::fmt<|>;
", ",
); );
@ -492,14 +492,14 @@ use std::fmt<|>;
fn test_replace_add_use_no_anchor_in_mod_mod() { fn test_replace_add_use_no_anchor_in_mod_mod() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
mod foo { mod foo {
mod bar { mod bar {
std::fmt::Debug<|> std::fmt::Debug<|>
} }
} }
", ",
" r"
mod foo { mod foo {
mod bar { mod bar {
use std::fmt::Debug; use std::fmt::Debug;
@ -515,14 +515,14 @@ mod foo {
fn inserts_imports_after_inner_attributes() { fn inserts_imports_after_inner_attributes() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
#![allow(dead_code)] #![allow(dead_code)]
fn main() { fn main() {
std::fmt::Debug<|> std::fmt::Debug<|>
} }
", ",
" r"
#![allow(dead_code)] #![allow(dead_code)]
use std::fmt::Debug; use std::fmt::Debug;
@ -537,13 +537,13 @@ fn main() {
fn replaces_all_affected_paths() { fn replaces_all_affected_paths() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
fn main() { fn main() {
std::fmt::Debug<|>; std::fmt::Debug<|>;
let x: std::fmt::Debug = std::fmt::Debug; let x: std::fmt::Debug = std::fmt::Debug;
} }
", ",
" r"
use std::fmt::Debug; use std::fmt::Debug;
fn main() { fn main() {
@ -558,7 +558,7 @@ fn main() {
fn replaces_all_affected_paths_mod() { fn replaces_all_affected_paths_mod() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
mod m { mod m {
fn f() { fn f() {
std::fmt::Debug<|>; std::fmt::Debug<|>;
@ -573,7 +573,7 @@ fn f() {
std::fmt::Debug; std::fmt::Debug;
} }
", ",
" r"
mod m { mod m {
use std::fmt::Debug; use std::fmt::Debug;
@ -597,7 +597,7 @@ fn f() {
fn does_not_replace_in_submodules() { fn does_not_replace_in_submodules() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
fn main() { fn main() {
std::fmt::Debug<|>; std::fmt::Debug<|>;
} }
@ -608,7 +608,7 @@ mod sub {
} }
} }
", ",
" r"
use std::fmt::Debug; use std::fmt::Debug;
fn main() { fn main() {
@ -628,14 +628,14 @@ mod sub {
fn does_not_replace_in_use() { fn does_not_replace_in_use() {
check_assist( check_assist(
replace_qualified_name_with_use, replace_qualified_name_with_use,
" r"
use std::fmt::Display; use std::fmt::Display;
fn main() { fn main() {
std::fmt<|>; std::fmt<|>;
} }
", ",
" r"
use std::fmt::{self, Display}; use std::fmt::{self, Display};
fn main() { fn main() {