]> git.lizzy.rs Git - rust.git/commitdiff
rustfmt
authorEvgenii P <eupn@protonmail.com>
Fri, 2 Aug 2019 18:16:20 +0000 (01:16 +0700)
committerEvgenii P <eupn@protonmail.com>
Fri, 2 Aug 2019 18:16:20 +0000 (01:16 +0700)
crates/ra_hir/src/source_binder.rs
crates/ra_hir/src/ty/method_resolution.rs
crates/ra_ide_api/src/completion/complete_dot.rs

index 8496b143aea6dda92456d97e069404b76ed92a18..67cb19615d1d9eba5c4a27a30692dc846f1f906f 100644 (file)
@@ -23,8 +23,8 @@
         scope::{ExprScopes, ScopeId},
         BodySourceMap,
     },
-    ty::method_resolution::implements_trait,
     ids::LocationCtx,
+    ty::method_resolution::implements_trait,
     AsName, AstId, Const, Crate, DefWithBody, Either, Enum, Function, HirDatabase, HirFileId,
     MacroDef, Module, Name, Path, PerNs, Resolver, Static, Struct, Trait, Ty,
 };
@@ -414,22 +414,25 @@ pub fn autoderef<'a>(
     /// This function is used in `.await` syntax completion.
     pub fn impls_future(&self, db: &impl HirDatabase, ty: Ty) -> bool {
         // Search for std::future::Future trait in scope
-        let future_trait = self.resolver.traits_in_scope(db)
+        let future_trait = self
+            .resolver
+            .traits_in_scope(db)
             .into_iter()
             .filter(|t| {
-                let std = t.module(db).parent(db)
-                    .and_then(|m| m
-                        .name(db)
-                        .and_then(|n| Some(n.to_string() == "std")))
+                let std = t
+                    .module(db)
+                    .parent(db)
+                    .and_then(|m| m.name(db).and_then(|n| Some(n.to_string() == "std")))
                     .unwrap_or(false);
 
-                let future = t.module(db).name(db)
+                let future = t
+                    .module(db)
+                    .name(db)
                     .and_then(|n| Some(n.to_string() == "future"))
                     .unwrap_or(false);
 
-                let future_trait = t.name(db)
-                    .and_then(|n| Some(n.to_string() == "Future"))
-                    .unwrap_or(false);
+                let future_trait =
+                    t.name(db).and_then(|n| Some(n.to_string() == "Future")).unwrap_or(false);
 
                 std && future && future_trait
             })
index 2e2f881388a4ad360ebb9ff89c57854384780b81..8731d6ba49037e739e8ec9c813020ee04c6bdd6f 100644 (file)
@@ -15,7 +15,7 @@
     resolve::Resolver,
     traits::TraitItem,
     ty::primitive::{FloatBitness, UncertainFloatTy, UncertainIntTy},
-    ty::{Ty, TypeCtor, traits::Solution},
+    ty::{traits::Solution, Ty, TypeCtor},
     Crate, Function, HirDatabase, Module, Name, Trait,
 };
 
@@ -255,14 +255,20 @@ fn iterate_inherent_methods<T>(
     None
 }
 
-pub(crate) fn implements_trait(ty: &Canonical<Ty>, db: &impl HirDatabase, resolver: &Resolver, krate: Crate, trait_: Trait) -> bool {
+pub(crate) fn implements_trait(
+    ty: &Canonical<Ty>,
+    db: &impl HirDatabase,
+    resolver: &Resolver,
+    krate: Crate,
+    trait_: Trait,
+) -> bool {
     let env = lower::trait_env(db, resolver);
     let goal = generic_implements_goal(db, env.clone(), trait_, ty.clone());
     let solution = db.trait_solve(krate, goal);
 
     if let Some(solution) = solution {
         if let Solution::Unique(_) = solution {
-            return true
+            return true;
         }
     }
 
index b6579be63f8c9799fb85d38ac46496f2a44bed86..1dbbdb1bc132d38eef8bd60b345a144677585812 100644 (file)
@@ -1,14 +1,14 @@
 use hir::{AdtDef, Ty, TypeCtor};
 
-use crate::{completion::{
-    completion_context::CompletionContext,
-    completion_item::Completions,
-}, CompletionItem};
+use crate::completion::completion_item::{Builder, CompletionKind};
+use crate::{
+    completion::{completion_context::CompletionContext, completion_item::Completions},
+    CompletionItem,
+};
 use ra_syntax::ast::AstNode;
+use ra_syntax::TextRange;
 use ra_text_edit::TextEditBuilder;
 use rustc_hash::FxHashSet;
-use crate::completion::completion_item::{Builder, CompletionKind};
-use ra_syntax::TextRange;
 
 /// Applies postfix edition but with CompletionKind::Reference
 fn postfix_reference(ctx: &CompletionContext, label: &str, detail: &str, snippet: &str) -> Builder {