diff options
author | adamrk <[email protected]> | 2020-06-20 10:32:01 +0100 |
---|---|---|
committer | adamrk <[email protected]> | 2020-06-20 10:32:01 +0100 |
commit | 436dcd9656b89b10a9719828a3421b4586ac331f (patch) | |
tree | bb981a4da518e0a578af79cd609cc42531f72172 /crates/ra_ide/src | |
parent | f0c8058f1236474b22b69971524015558384c077 (diff) |
move tests to ra_hir_ty
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/hover.rs | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index a03024d09..d870e4cbc 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -2410,108 +2410,4 @@ fn func(foo: i32) { if true { <|>foo; }; } | |||
2410 | ] | 2410 | ] |
2411 | "###); | 2411 | "###); |
2412 | } | 2412 | } |
2413 | |||
2414 | #[test] | ||
2415 | fn infer_closure_arg() { | ||
2416 | check_hover_result( | ||
2417 | r#" | ||
2418 | //- /lib.rs | ||
2419 | |||
2420 | enum Option<T> { | ||
2421 | None, | ||
2422 | Some(T) | ||
2423 | } | ||
2424 | |||
2425 | fn foo() { | ||
2426 | let s<|> = Option::None; | ||
2427 | let f = |x: Option<i32>| {}; | ||
2428 | (&f)(s) | ||
2429 | } | ||
2430 | "#, | ||
2431 | &["Option<i32>"], | ||
2432 | ); | ||
2433 | } | ||
2434 | |||
2435 | #[test] | ||
2436 | fn infer_fn_trait_arg() { | ||
2437 | check_hover_result( | ||
2438 | r#" | ||
2439 | //- /lib.rs deps:std | ||
2440 | |||
2441 | #[lang = "fn_once"] | ||
2442 | pub trait FnOnce<Args> { | ||
2443 | type Output; | ||
2444 | |||
2445 | extern "rust-call" fn call_once(&self, args: Args) -> Self::Output; | ||
2446 | } | ||
2447 | |||
2448 | #[lang = "fn"] | ||
2449 | pub trait Fn<Args>:FnOnce<Args> { | ||
2450 | extern "rust-call" fn call(&self, args: Args) -> Self::Output; | ||
2451 | } | ||
2452 | |||
2453 | enum Option<T> { | ||
2454 | None, | ||
2455 | Some(T) | ||
2456 | } | ||
2457 | |||
2458 | fn foo<F, T>(f: F) -> T | ||
2459 | where | ||
2460 | F: Fn(Option<i32>) -> T, | ||
2461 | { | ||
2462 | let s<|> = None; | ||
2463 | f(s) | ||
2464 | } | ||
2465 | "#, | ||
2466 | &["Option<i32>"], | ||
2467 | ); | ||
2468 | } | ||
2469 | |||
2470 | #[test] | ||
2471 | fn infer_box_fn_arg() { | ||
2472 | check_hover_result( | ||
2473 | r#" | ||
2474 | //- /lib.rs deps:std | ||
2475 | |||
2476 | #[lang = "fn_once"] | ||
2477 | pub trait FnOnce<Args> { | ||
2478 | type Output; | ||
2479 | |||
2480 | extern "rust-call" fn call_once(self, args: Args) -> Self::Output; | ||
2481 | } | ||
2482 | |||
2483 | #[lang = "deref"] | ||
2484 | pub trait Deref { | ||
2485 | type Target: ?Sized; | ||
2486 | |||
2487 | fn deref(&self) -> &Self::Target; | ||
2488 | } | ||
2489 | |||
2490 | #[lang = "owned_box"] | ||
2491 | pub struct Box<T: ?Sized> { | ||
2492 | inner: *mut T, | ||
2493 | } | ||
2494 | |||
2495 | impl<T: ?Sized> Deref for Box<T> { | ||
2496 | type Target = T; | ||
2497 | |||
2498 | fn deref(&self) -> &T { | ||
2499 | &self.inner | ||
2500 | } | ||
2501 | } | ||
2502 | |||
2503 | enum Option<T> { | ||
2504 | None, | ||
2505 | Some(T) | ||
2506 | } | ||
2507 | |||
2508 | fn foo() { | ||
2509 | let s<|> = Option::None; | ||
2510 | let f: Box<dyn FnOnce(&Option<i32>)> = box (|ps| {}); | ||
2511 | f(&s) | ||
2512 | } | ||
2513 | "#, | ||
2514 | &["Option<i32>"], | ||
2515 | ); | ||
2516 | } | ||
2517 | } | 2413 | } |