diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir_def/src/data.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_def/src/path.rs | 20 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/expr.rs | 10 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/infer.rs | 16 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/simple.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/traits.rs | 30 | ||||
-rw-r--r-- | crates/ra_ide/src/diagnostics.rs | 56 |
7 files changed, 65 insertions, 73 deletions
diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs index 807195d25..53599e74a 100644 --- a/crates/ra_hir_def/src/data.rs +++ b/crates/ra_hir_def/src/data.rs | |||
@@ -99,7 +99,7 @@ impl FunctionData { | |||
99 | } | 99 | } |
100 | 100 | ||
101 | fn desugar_future_path(orig: TypeRef) -> Path { | 101 | fn desugar_future_path(orig: TypeRef) -> Path { |
102 | let path = path![std::future::Future]; | 102 | let path = path![core::future::Future]; |
103 | let mut generic_args: Vec<_> = std::iter::repeat(None).take(path.segments.len() - 1).collect(); | 103 | let mut generic_args: Vec<_> = std::iter::repeat(None).take(path.segments.len() - 1).collect(); |
104 | let mut last = GenericArgs::empty(); | 104 | let mut last = GenericArgs::empty(); |
105 | last.bindings.push(AssociatedTypeBinding { | 105 | last.bindings.push(AssociatedTypeBinding { |
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs index bfa921de2..ba16442bd 100644 --- a/crates/ra_hir_def/src/path.rs +++ b/crates/ra_hir_def/src/path.rs | |||
@@ -323,16 +323,16 @@ pub use hir_expand::name as __name; | |||
323 | 323 | ||
324 | #[macro_export] | 324 | #[macro_export] |
325 | macro_rules! __known_path { | 325 | macro_rules! __known_path { |
326 | (std::iter::IntoIterator) => {}; | 326 | (core::iter::IntoIterator) => {}; |
327 | (std::result::Result) => {}; | 327 | (core::result::Result) => {}; |
328 | (std::ops::Range) => {}; | 328 | (core::ops::Range) => {}; |
329 | (std::ops::RangeFrom) => {}; | 329 | (core::ops::RangeFrom) => {}; |
330 | (std::ops::RangeFull) => {}; | 330 | (core::ops::RangeFull) => {}; |
331 | (std::ops::RangeTo) => {}; | 331 | (core::ops::RangeTo) => {}; |
332 | (std::ops::RangeToInclusive) => {}; | 332 | (core::ops::RangeToInclusive) => {}; |
333 | (std::ops::RangeInclusive) => {}; | 333 | (core::ops::RangeInclusive) => {}; |
334 | (std::future::Future) => {}; | 334 | (core::future::Future) => {}; |
335 | (std::ops::Try) => {}; | 335 | (core::ops::Try) => {}; |
336 | ($path:path) => { | 336 | ($path:path) => { |
337 | compile_error!("Please register your known path in the path module") | 337 | compile_error!("Please register your known path in the path module") |
338 | }; | 338 | }; |
diff --git a/crates/ra_hir_ty/src/expr.rs b/crates/ra_hir_ty/src/expr.rs index f04968e14..7db928dde 100644 --- a/crates/ra_hir_ty/src/expr.rs +++ b/crates/ra_hir_ty/src/expr.rs | |||
@@ -226,17 +226,19 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
226 | None => return, | 226 | None => return, |
227 | }; | 227 | }; |
228 | 228 | ||
229 | let std_result_path = path![std::result::Result]; | 229 | let core_result_path = path![core::result::Result]; |
230 | 230 | ||
231 | let resolver = self.func.resolver(db.upcast()); | 231 | let resolver = self.func.resolver(db.upcast()); |
232 | let std_result_enum = match resolver.resolve_known_enum(db.upcast(), &std_result_path) { | 232 | let core_result_enum = match resolver.resolve_known_enum(db.upcast(), &core_result_path) { |
233 | Some(it) => it, | 233 | Some(it) => it, |
234 | _ => return, | 234 | _ => return, |
235 | }; | 235 | }; |
236 | 236 | ||
237 | let std_result_ctor = TypeCtor::Adt(AdtId::EnumId(std_result_enum)); | 237 | let core_result_ctor = TypeCtor::Adt(AdtId::EnumId(core_result_enum)); |
238 | let params = match &mismatch.expected { | 238 | let params = match &mismatch.expected { |
239 | Ty::Apply(ApplicationTy { ctor, parameters }) if ctor == &std_result_ctor => parameters, | 239 | Ty::Apply(ApplicationTy { ctor, parameters }) if ctor == &core_result_ctor => { |
240 | parameters | ||
241 | } | ||
240 | _ => return, | 242 | _ => return, |
241 | }; | 243 | }; |
242 | 244 | ||
diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/ra_hir_ty/src/infer.rs index f965eb2b5..3719f76a6 100644 --- a/crates/ra_hir_ty/src/infer.rs +++ b/crates/ra_hir_ty/src/infer.rs | |||
@@ -555,13 +555,13 @@ impl<'a> InferenceContext<'a> { | |||
555 | } | 555 | } |
556 | 556 | ||
557 | fn resolve_into_iter_item(&self) -> Option<TypeAliasId> { | 557 | fn resolve_into_iter_item(&self) -> Option<TypeAliasId> { |
558 | let path = path![std::iter::IntoIterator]; | 558 | let path = path![core::iter::IntoIterator]; |
559 | let trait_ = self.resolver.resolve_known_trait(self.db.upcast(), &path)?; | 559 | let trait_ = self.resolver.resolve_known_trait(self.db.upcast(), &path)?; |
560 | self.db.trait_data(trait_).associated_type_by_name(&name![Item]) | 560 | self.db.trait_data(trait_).associated_type_by_name(&name![Item]) |
561 | } | 561 | } |
562 | 562 | ||
563 | fn resolve_ops_try_ok(&self) -> Option<TypeAliasId> { | 563 | fn resolve_ops_try_ok(&self) -> Option<TypeAliasId> { |
564 | let path = path![std::ops::Try]; | 564 | let path = path![core::ops::Try]; |
565 | let trait_ = self.resolver.resolve_known_trait(self.db.upcast(), &path)?; | 565 | let trait_ = self.resolver.resolve_known_trait(self.db.upcast(), &path)?; |
566 | self.db.trait_data(trait_).associated_type_by_name(&name![Ok]) | 566 | self.db.trait_data(trait_).associated_type_by_name(&name![Ok]) |
567 | } | 567 | } |
@@ -587,37 +587,37 @@ impl<'a> InferenceContext<'a> { | |||
587 | } | 587 | } |
588 | 588 | ||
589 | fn resolve_range_full(&self) -> Option<AdtId> { | 589 | fn resolve_range_full(&self) -> Option<AdtId> { |
590 | let path = path![std::ops::RangeFull]; | 590 | let path = path![core::ops::RangeFull]; |
591 | let struct_ = self.resolver.resolve_known_struct(self.db.upcast(), &path)?; | 591 | let struct_ = self.resolver.resolve_known_struct(self.db.upcast(), &path)?; |
592 | Some(struct_.into()) | 592 | Some(struct_.into()) |
593 | } | 593 | } |
594 | 594 | ||
595 | fn resolve_range(&self) -> Option<AdtId> { | 595 | fn resolve_range(&self) -> Option<AdtId> { |
596 | let path = path![std::ops::Range]; | 596 | let path = path![core::ops::Range]; |
597 | let struct_ = self.resolver.resolve_known_struct(self.db.upcast(), &path)?; | 597 | let struct_ = self.resolver.resolve_known_struct(self.db.upcast(), &path)?; |
598 | Some(struct_.into()) | 598 | Some(struct_.into()) |
599 | } | 599 | } |
600 | 600 | ||
601 | fn resolve_range_inclusive(&self) -> Option<AdtId> { | 601 | fn resolve_range_inclusive(&self) -> Option<AdtId> { |
602 | let path = path![std::ops::RangeInclusive]; | 602 | let path = path![core::ops::RangeInclusive]; |
603 | let struct_ = self.resolver.resolve_known_struct(self.db.upcast(), &path)?; | 603 | let struct_ = self.resolver.resolve_known_struct(self.db.upcast(), &path)?; |
604 | Some(struct_.into()) | 604 | Some(struct_.into()) |
605 | } | 605 | } |
606 | 606 | ||
607 | fn resolve_range_from(&self) -> Option<AdtId> { | 607 | fn resolve_range_from(&self) -> Option<AdtId> { |
608 | let path = path![std::ops::RangeFrom]; | 608 | let path = path![core::ops::RangeFrom]; |
609 | let struct_ = self.resolver.resolve_known_struct(self.db.upcast(), &path)?; | 609 | let struct_ = self.resolver.resolve_known_struct(self.db.upcast(), &path)?; |
610 | Some(struct_.into()) | 610 | Some(struct_.into()) |
611 | } | 611 | } |
612 | 612 | ||
613 | fn resolve_range_to(&self) -> Option<AdtId> { | 613 | fn resolve_range_to(&self) -> Option<AdtId> { |
614 | let path = path![std::ops::RangeTo]; | 614 | let path = path![core::ops::RangeTo]; |
615 | let struct_ = self.resolver.resolve_known_struct(self.db.upcast(), &path)?; | 615 | let struct_ = self.resolver.resolve_known_struct(self.db.upcast(), &path)?; |
616 | Some(struct_.into()) | 616 | Some(struct_.into()) |
617 | } | 617 | } |
618 | 618 | ||
619 | fn resolve_range_to_inclusive(&self) -> Option<AdtId> { | 619 | fn resolve_range_to_inclusive(&self) -> Option<AdtId> { |
620 | let path = path![std::ops::RangeToInclusive]; | 620 | let path = path![core::ops::RangeToInclusive]; |
621 | let struct_ = self.resolver.resolve_known_struct(self.db.upcast(), &path)?; | 621 | let struct_ = self.resolver.resolve_known_struct(self.db.upcast(), &path)?; |
622 | Some(struct_.into()) | 622 | Some(struct_.into()) |
623 | } | 623 | } |
diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/ra_hir_ty/src/tests/simple.rs index 8a5031756..37659cd02 100644 --- a/crates/ra_hir_ty/src/tests/simple.rs +++ b/crates/ra_hir_ty/src/tests/simple.rs | |||
@@ -95,7 +95,7 @@ fn foo() { | |||
95 | fn infer_ranges() { | 95 | fn infer_ranges() { |
96 | let (db, pos) = TestDB::with_position( | 96 | let (db, pos) = TestDB::with_position( |
97 | r#" | 97 | r#" |
98 | //- /main.rs crate:main deps:std | 98 | //- /main.rs crate:main deps:core |
99 | fn test() { | 99 | fn test() { |
100 | let a = ..; | 100 | let a = ..; |
101 | let b = 1..; | 101 | let b = 1..; |
@@ -108,7 +108,7 @@ fn test() { | |||
108 | t<|>; | 108 | t<|>; |
109 | } | 109 | } |
110 | 110 | ||
111 | //- /std.rs crate:std | 111 | //- /core.rs crate:core |
112 | #[prelude_import] use prelude::*; | 112 | #[prelude_import] use prelude::*; |
113 | mod prelude {} | 113 | mod prelude {} |
114 | 114 | ||
diff --git a/crates/ra_hir_ty/src/tests/traits.rs b/crates/ra_hir_ty/src/tests/traits.rs index 133fb5f39..e81193a3c 100644 --- a/crates/ra_hir_ty/src/tests/traits.rs +++ b/crates/ra_hir_ty/src/tests/traits.rs | |||
@@ -10,7 +10,7 @@ use super::{infer, infer_with_mismatches, type_at, type_at_pos}; | |||
10 | fn infer_await() { | 10 | fn infer_await() { |
11 | let (db, pos) = TestDB::with_position( | 11 | let (db, pos) = TestDB::with_position( |
12 | r#" | 12 | r#" |
13 | //- /main.rs crate:main deps:std | 13 | //- /main.rs crate:main deps:core |
14 | 14 | ||
15 | struct IntFuture; | 15 | struct IntFuture; |
16 | 16 | ||
@@ -24,7 +24,7 @@ fn test() { | |||
24 | v<|>; | 24 | v<|>; |
25 | } | 25 | } |
26 | 26 | ||
27 | //- /std.rs crate:std | 27 | //- /core.rs crate:core |
28 | #[prelude_import] use future::*; | 28 | #[prelude_import] use future::*; |
29 | mod future { | 29 | mod future { |
30 | #[lang = "future_trait"] | 30 | #[lang = "future_trait"] |
@@ -42,7 +42,7 @@ mod future { | |||
42 | fn infer_async() { | 42 | fn infer_async() { |
43 | let (db, pos) = TestDB::with_position( | 43 | let (db, pos) = TestDB::with_position( |
44 | r#" | 44 | r#" |
45 | //- /main.rs crate:main deps:std | 45 | //- /main.rs crate:main deps:core |
46 | 46 | ||
47 | async fn foo() -> u64 { | 47 | async fn foo() -> u64 { |
48 | 128 | 48 | 128 |
@@ -54,7 +54,7 @@ fn test() { | |||
54 | v<|>; | 54 | v<|>; |
55 | } | 55 | } |
56 | 56 | ||
57 | //- /std.rs crate:std | 57 | //- /core.rs crate:core |
58 | #[prelude_import] use future::*; | 58 | #[prelude_import] use future::*; |
59 | mod future { | 59 | mod future { |
60 | #[lang = "future_trait"] | 60 | #[lang = "future_trait"] |
@@ -72,7 +72,7 @@ mod future { | |||
72 | fn infer_desugar_async() { | 72 | fn infer_desugar_async() { |
73 | let (db, pos) = TestDB::with_position( | 73 | let (db, pos) = TestDB::with_position( |
74 | r#" | 74 | r#" |
75 | //- /main.rs crate:main deps:std | 75 | //- /main.rs crate:main deps:core |
76 | 76 | ||
77 | async fn foo() -> u64 { | 77 | async fn foo() -> u64 { |
78 | 128 | 78 | 128 |
@@ -83,7 +83,7 @@ fn test() { | |||
83 | r<|>; | 83 | r<|>; |
84 | } | 84 | } |
85 | 85 | ||
86 | //- /std.rs crate:std | 86 | //- /core.rs crate:core |
87 | #[prelude_import] use future::*; | 87 | #[prelude_import] use future::*; |
88 | mod future { | 88 | mod future { |
89 | trait Future { | 89 | trait Future { |
@@ -100,7 +100,7 @@ mod future { | |||
100 | fn infer_try() { | 100 | fn infer_try() { |
101 | let (db, pos) = TestDB::with_position( | 101 | let (db, pos) = TestDB::with_position( |
102 | r#" | 102 | r#" |
103 | //- /main.rs crate:main deps:std | 103 | //- /main.rs crate:main deps:core |
104 | 104 | ||
105 | fn test() { | 105 | fn test() { |
106 | let r: Result<i32, u64> = Result::Ok(1); | 106 | let r: Result<i32, u64> = Result::Ok(1); |
@@ -108,7 +108,7 @@ fn test() { | |||
108 | v<|>; | 108 | v<|>; |
109 | } | 109 | } |
110 | 110 | ||
111 | //- /std.rs crate:std | 111 | //- /core.rs crate:core |
112 | 112 | ||
113 | #[prelude_import] use ops::*; | 113 | #[prelude_import] use ops::*; |
114 | mod ops { | 114 | mod ops { |
@@ -140,9 +140,9 @@ mod result { | |||
140 | fn infer_for_loop() { | 140 | fn infer_for_loop() { |
141 | let (db, pos) = TestDB::with_position( | 141 | let (db, pos) = TestDB::with_position( |
142 | r#" | 142 | r#" |
143 | //- /main.rs crate:main deps:std | 143 | //- /main.rs crate:main deps:core,alloc |
144 | 144 | ||
145 | use std::collections::Vec; | 145 | use alloc::collections::Vec; |
146 | 146 | ||
147 | fn test() { | 147 | fn test() { |
148 | let v = Vec::new(); | 148 | let v = Vec::new(); |
@@ -152,7 +152,7 @@ fn test() { | |||
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | //- /std.rs crate:std | 155 | //- /core.rs crate:core |
156 | 156 | ||
157 | #[prelude_import] use iter::*; | 157 | #[prelude_import] use iter::*; |
158 | mod iter { | 158 | mod iter { |
@@ -161,6 +161,8 @@ mod iter { | |||
161 | } | 161 | } |
162 | } | 162 | } |
163 | 163 | ||
164 | //- /alloc.rs crate:alloc deps:core | ||
165 | |||
164 | mod collections { | 166 | mod collections { |
165 | struct Vec<T> {} | 167 | struct Vec<T> {} |
166 | impl<T> Vec<T> { | 168 | impl<T> Vec<T> { |
@@ -168,7 +170,7 @@ mod collections { | |||
168 | fn push(&mut self, t: T) { } | 170 | fn push(&mut self, t: T) { } |
169 | } | 171 | } |
170 | 172 | ||
171 | impl<T> crate::iter::IntoIterator for Vec<T> { | 173 | impl<T> IntoIterator for Vec<T> { |
172 | type Item=T; | 174 | type Item=T; |
173 | } | 175 | } |
174 | } | 176 | } |
@@ -2846,12 +2848,12 @@ fn test() { | |||
2846 | fn integer_range_iterate() { | 2848 | fn integer_range_iterate() { |
2847 | let t = type_at( | 2849 | let t = type_at( |
2848 | r#" | 2850 | r#" |
2849 | //- /main.rs crate:main deps:std | 2851 | //- /main.rs crate:main deps:core |
2850 | fn test() { | 2852 | fn test() { |
2851 | for x in 0..100 { x<|>; } | 2853 | for x in 0..100 { x<|>; } |
2852 | } | 2854 | } |
2853 | 2855 | ||
2854 | //- /std.rs crate:std | 2856 | //- /core.rs crate:core |
2855 | pub mod ops { | 2857 | pub mod ops { |
2856 | pub struct Range<Idx> { | 2858 | pub struct Range<Idx> { |
2857 | pub start: Idx, | 2859 | pub start: Idx, |
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index bf14a467f..f44feaf69 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs | |||
@@ -321,29 +321,26 @@ mod tests { | |||
321 | fn test_wrap_return_type() { | 321 | fn test_wrap_return_type() { |
322 | let before = r#" | 322 | let before = r#" |
323 | //- /main.rs | 323 | //- /main.rs |
324 | use std::{string::String, result::Result::{self, Ok, Err}}; | 324 | use core::result::Result::{self, Ok, Err}; |
325 | 325 | ||
326 | fn div(x: i32, y: i32) -> Result<i32, String> { | 326 | fn div(x: i32, y: i32) -> Result<i32, ()> { |
327 | if y == 0 { | 327 | if y == 0 { |
328 | return Err("div by zero".into()); | 328 | return Err(()); |
329 | } | 329 | } |
330 | x / y<|> | 330 | x / y<|> |
331 | } | 331 | } |
332 | 332 | ||
333 | //- /std/lib.rs | 333 | //- /core/lib.rs |
334 | pub mod string { | ||
335 | pub struct String { } | ||
336 | } | ||
337 | pub mod result { | 334 | pub mod result { |
338 | pub enum Result<T, E> { Ok(T), Err(E) } | 335 | pub enum Result<T, E> { Ok(T), Err(E) } |
339 | } | 336 | } |
340 | "#; | 337 | "#; |
341 | let after = r#" | 338 | let after = r#" |
342 | use std::{string::String, result::Result::{self, Ok, Err}}; | 339 | use core::result::Result::{self, Ok, Err}; |
343 | 340 | ||
344 | fn div(x: i32, y: i32) -> Result<i32, String> { | 341 | fn div(x: i32, y: i32) -> Result<i32, ()> { |
345 | if y == 0 { | 342 | if y == 0 { |
346 | return Err("div by zero".into()); | 343 | return Err(()); |
347 | } | 344 | } |
348 | Ok(x / y) | 345 | Ok(x / y) |
349 | } | 346 | } |
@@ -355,7 +352,7 @@ mod tests { | |||
355 | fn test_wrap_return_type_handles_generic_functions() { | 352 | fn test_wrap_return_type_handles_generic_functions() { |
356 | let before = r#" | 353 | let before = r#" |
357 | //- /main.rs | 354 | //- /main.rs |
358 | use std::result::Result::{self, Ok, Err}; | 355 | use core::result::Result::{self, Ok, Err}; |
359 | 356 | ||
360 | fn div<T>(x: T) -> Result<T, i32> { | 357 | fn div<T>(x: T) -> Result<T, i32> { |
361 | if x == 0 { | 358 | if x == 0 { |
@@ -364,13 +361,13 @@ mod tests { | |||
364 | <|>x | 361 | <|>x |
365 | } | 362 | } |
366 | 363 | ||
367 | //- /std/lib.rs | 364 | //- /core/lib.rs |
368 | pub mod result { | 365 | pub mod result { |
369 | pub enum Result<T, E> { Ok(T), Err(E) } | 366 | pub enum Result<T, E> { Ok(T), Err(E) } |
370 | } | 367 | } |
371 | "#; | 368 | "#; |
372 | let after = r#" | 369 | let after = r#" |
373 | use std::result::Result::{self, Ok, Err}; | 370 | use core::result::Result::{self, Ok, Err}; |
374 | 371 | ||
375 | fn div<T>(x: T) -> Result<T, i32> { | 372 | fn div<T>(x: T) -> Result<T, i32> { |
376 | if x == 0 { | 373 | if x == 0 { |
@@ -386,32 +383,29 @@ mod tests { | |||
386 | fn test_wrap_return_type_handles_type_aliases() { | 383 | fn test_wrap_return_type_handles_type_aliases() { |
387 | let before = r#" | 384 | let before = r#" |
388 | //- /main.rs | 385 | //- /main.rs |
389 | use std::{string::String, result::Result::{self, Ok, Err}}; | 386 | use core::result::Result::{self, Ok, Err}; |
390 | 387 | ||
391 | type MyResult<T> = Result<T, String>; | 388 | type MyResult<T> = Result<T, ()>; |
392 | 389 | ||
393 | fn div(x: i32, y: i32) -> MyResult<i32> { | 390 | fn div(x: i32, y: i32) -> MyResult<i32> { |
394 | if y == 0 { | 391 | if y == 0 { |
395 | return Err("div by zero".into()); | 392 | return Err(()); |
396 | } | 393 | } |
397 | x <|>/ y | 394 | x <|>/ y |
398 | } | 395 | } |
399 | 396 | ||
400 | //- /std/lib.rs | 397 | //- /core/lib.rs |
401 | pub mod string { | ||
402 | pub struct String { } | ||
403 | } | ||
404 | pub mod result { | 398 | pub mod result { |
405 | pub enum Result<T, E> { Ok(T), Err(E) } | 399 | pub enum Result<T, E> { Ok(T), Err(E) } |
406 | } | 400 | } |
407 | "#; | 401 | "#; |
408 | let after = r#" | 402 | let after = r#" |
409 | use std::{string::String, result::Result::{self, Ok, Err}}; | 403 | use core::result::Result::{self, Ok, Err}; |
410 | 404 | ||
411 | type MyResult<T> = Result<T, String>; | 405 | type MyResult<T> = Result<T, ()>; |
412 | fn div(x: i32, y: i32) -> MyResult<i32> { | 406 | fn div(x: i32, y: i32) -> MyResult<i32> { |
413 | if y == 0 { | 407 | if y == 0 { |
414 | return Err("div by zero".into()); | 408 | return Err(()); |
415 | } | 409 | } |
416 | Ok(x / y) | 410 | Ok(x / y) |
417 | } | 411 | } |
@@ -423,16 +417,13 @@ mod tests { | |||
423 | fn test_wrap_return_type_not_applicable_when_expr_type_does_not_match_ok_type() { | 417 | fn test_wrap_return_type_not_applicable_when_expr_type_does_not_match_ok_type() { |
424 | let content = r#" | 418 | let content = r#" |
425 | //- /main.rs | 419 | //- /main.rs |
426 | use std::{string::String, result::Result::{self, Ok, Err}}; | 420 | use core::result::Result::{self, Ok, Err}; |
427 | 421 | ||
428 | fn foo() -> Result<String, i32> { | 422 | fn foo() -> Result<(), i32> { |
429 | 0<|> | 423 | 0<|> |
430 | } | 424 | } |
431 | 425 | ||
432 | //- /std/lib.rs | 426 | //- /core/lib.rs |
433 | pub mod string { | ||
434 | pub struct String { } | ||
435 | } | ||
436 | pub mod result { | 427 | pub mod result { |
437 | pub enum Result<T, E> { Ok(T), Err(E) } | 428 | pub enum Result<T, E> { Ok(T), Err(E) } |
438 | } | 429 | } |
@@ -444,7 +435,7 @@ mod tests { | |||
444 | fn test_wrap_return_type_not_applicable_when_return_type_is_not_result() { | 435 | fn test_wrap_return_type_not_applicable_when_return_type_is_not_result() { |
445 | let content = r#" | 436 | let content = r#" |
446 | //- /main.rs | 437 | //- /main.rs |
447 | use std::{string::String, result::Result::{self, Ok, Err}}; | 438 | use core::result::Result::{self, Ok, Err}; |
448 | 439 | ||
449 | enum SomeOtherEnum { | 440 | enum SomeOtherEnum { |
450 | Ok(i32), | 441 | Ok(i32), |
@@ -455,10 +446,7 @@ mod tests { | |||
455 | 0<|> | 446 | 0<|> |
456 | } | 447 | } |
457 | 448 | ||
458 | //- /std/lib.rs | 449 | //- /core/lib.rs |
459 | pub mod string { | ||
460 | pub struct String { } | ||
461 | } | ||
462 | pub mod result { | 450 | pub mod result { |
463 | pub enum Result<T, E> { Ok(T), Err(E) } | 451 | pub enum Result<T, E> { Ok(T), Err(E) } |
464 | } | 452 | } |