aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-02-06 21:11:24 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-02-06 21:11:24 +0000
commita69ee774ca39f1300bd9dd7eb34b632db9098e26 (patch)
tree9da7f488f6564ac7f84d54ae9fc7296bcf2460e4 /crates/ra_hir/src
parentc1e10a24fa3ba2b03a738afd8e1f7f472a12e29f (diff)
parent6753051a45e067fb8267f7ecbbf1b894558718d1 (diff)
Merge #754
754: Some clippy things r=matklad a=kjeremy Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/expr.rs6
-rw-r--r--crates/ra_hir/src/expr/scope.rs4
-rw-r--r--crates/ra_hir/src/impl_block.rs2
-rw-r--r--crates/ra_hir/src/resolve.rs2
-rw-r--r--crates/ra_hir/src/ty.rs8
-rw-r--r--crates/ra_hir/src/ty/method_resolution.rs2
6 files changed, 12 insertions, 12 deletions
diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs
index f9f702ae2..6826e966b 100644
--- a/crates/ra_hir/src/expr.rs
+++ b/crates/ra_hir/src/expr.rs
@@ -805,7 +805,7 @@ impl ExprCollector {
805 let lit = match child.flavor() { 805 let lit = match child.flavor() {
806 LiteralFlavor::IntNumber { suffix } => { 806 LiteralFlavor::IntNumber { suffix } => {
807 let known_name = suffix 807 let known_name = suffix
808 .map(|s| Name::new(s)) 808 .map(Name::new)
809 .and_then(|name| UncertainIntTy::from_name(&name)); 809 .and_then(|name| UncertainIntTy::from_name(&name));
810 810
811 Literal::Int( 811 Literal::Int(
@@ -815,7 +815,7 @@ impl ExprCollector {
815 } 815 }
816 LiteralFlavor::FloatNumber { suffix } => { 816 LiteralFlavor::FloatNumber { suffix } => {
817 let known_name = suffix 817 let known_name = suffix
818 .map(|s| Name::new(s)) 818 .map(Name::new)
819 .and_then(|name| UncertainFloatTy::from_name(&name)); 819 .and_then(|name| UncertainFloatTy::from_name(&name));
820 820
821 Literal::Float( 821 Literal::Float(
@@ -910,7 +910,7 @@ impl ExprCollector {
910 } 910 }
911 ast::PatKind::PathPat(p) => { 911 ast::PatKind::PathPat(p) => {
912 let path = p.path().and_then(Path::from_ast); 912 let path = p.path().and_then(Path::from_ast);
913 path.map(|path| Pat::Path(path)).unwrap_or(Pat::Missing) 913 path.map(Pat::Path).unwrap_or(Pat::Missing)
914 } 914 }
915 ast::PatKind::TuplePat(p) => { 915 ast::PatKind::TuplePat(p) => {
916 let args = p.args().map(|p| self.collect_pat(p)).collect(); 916 let args = p.args().map(|p| self.collect_pat(p)).collect();
diff --git a/crates/ra_hir/src/expr/scope.rs b/crates/ra_hir/src/expr/scope.rs
index 9202e3671..368994bf7 100644
--- a/crates/ra_hir/src/expr/scope.rs
+++ b/crates/ra_hir/src/expr/scope.rs
@@ -105,7 +105,7 @@ impl ExprScopes {
105 fn add_params_bindings(&mut self, scope: ScopeId, params: &[PatId]) { 105 fn add_params_bindings(&mut self, scope: ScopeId, params: &[PatId]) {
106 let body = Arc::clone(&self.body); 106 let body = Arc::clone(&self.body);
107 params 107 params
108 .into_iter() 108 .iter()
109 .for_each(|pat| self.add_bindings(&body, scope, *pat)); 109 .for_each(|pat| self.add_bindings(&body, scope, *pat));
110 } 110 }
111 111
@@ -147,7 +147,7 @@ impl ScopesWithSyntaxMapping {
147 }) 147 })
148 } 148 }
149 149
150 pub fn scope_for_offset<'a>(&'a self, offset: TextUnit) -> Option<ScopeId> { 150 pub fn scope_for_offset(&self, offset: TextUnit) -> Option<ScopeId> {
151 self.scopes 151 self.scopes
152 .scope_for 152 .scope_for
153 .iter() 153 .iter()
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
index 738c58fbe..094dbedb3 100644
--- a/crates/ra_hir/src/impl_block.rs
+++ b/crates/ra_hir/src/impl_block.rs
@@ -72,7 +72,7 @@ impl ImplBlock {
72 } 72 }
73 73
74 pub fn module(&self) -> Module { 74 pub fn module(&self) -> Module {
75 self.module_impl_blocks.module.clone() 75 self.module_impl_blocks.module
76 } 76 }
77 77
78 pub fn target_trait_ref(&self) -> Option<&TypeRef> { 78 pub fn target_trait_ref(&self) -> Option<&TypeRef> {
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs
index 5ca7bacb5..0f60d4742 100644
--- a/crates/ra_hir/src/resolve.rs
+++ b/crates/ra_hir/src/resolve.rs
@@ -78,7 +78,7 @@ impl Resolver {
78 _ => return PerNs::none(), 78 _ => return PerNs::none(),
79 }; 79 };
80 let module_res = item_map.resolve_path(db, module, path); 80 let module_res = item_map.resolve_path(db, module, path);
81 module_res.map(|def| Resolution::Def(def)) 81 module_res.map(Resolution::Def)
82 } 82 }
83 } 83 }
84 84
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index cc5afad75..86a7f8b83 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -1225,7 +1225,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
1225 Ty::Tuple(ref tuple_args) => &**tuple_args, 1225 Ty::Tuple(ref tuple_args) => &**tuple_args,
1226 _ => &[], 1226 _ => &[],
1227 }; 1227 };
1228 let expectations_iter = expectations.into_iter().chain(repeat(&Ty::Unknown)); 1228 let expectations_iter = expectations.iter().chain(repeat(&Ty::Unknown));
1229 1229
1230 let inner_tys = args 1230 let inner_tys = args
1231 .iter() 1231 .iter()
@@ -1398,10 +1398,10 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
1398 let method_ty = self.insert_type_vars(method_ty); 1398 let method_ty = self.insert_type_vars(method_ty);
1399 let (expected_receiver_ty, param_tys, ret_ty) = match &method_ty { 1399 let (expected_receiver_ty, param_tys, ret_ty) = match &method_ty {
1400 Ty::FnPtr(sig) => { 1400 Ty::FnPtr(sig) => {
1401 if sig.input.len() > 0 { 1401 if !sig.input.is_empty() {
1402 ( 1402 (
1403 sig.input[0].clone(), 1403 sig.input[0].clone(),
1404 sig.input[1..].iter().cloned().collect(), 1404 sig.input[1..].to_vec(),
1405 sig.output.clone(), 1405 sig.output.clone(),
1406 ) 1406 )
1407 } else { 1407 } else {
@@ -1411,7 +1411,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
1411 Ty::FnDef { substs, sig, .. } => { 1411 Ty::FnDef { substs, sig, .. } => {
1412 let ret_ty = sig.output.clone().subst(&substs); 1412 let ret_ty = sig.output.clone().subst(&substs);
1413 1413
1414 if sig.input.len() > 0 { 1414 if !sig.input.is_empty() {
1415 let mut arg_iter = sig.input.iter().map(|ty| ty.clone().subst(&substs)); 1415 let mut arg_iter = sig.input.iter().map(|ty| ty.clone().subst(&substs));
1416 let receiver_ty = arg_iter.next().unwrap(); 1416 let receiver_ty = arg_iter.next().unwrap();
1417 (receiver_ty, arg_iter.collect(), ret_ty) 1417 (receiver_ty, arg_iter.collect(), ret_ty)
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs
index 2282286b0..a7d4517ee 100644
--- a/crates/ra_hir/src/ty/method_resolution.rs
+++ b/crates/ra_hir/src/ty/method_resolution.rs
@@ -113,7 +113,7 @@ impl CrateImplBlocks {
113 krate: Crate, 113 krate: Crate,
114 ) -> Arc<CrateImplBlocks> { 114 ) -> Arc<CrateImplBlocks> {
115 let mut crate_impl_blocks = CrateImplBlocks { 115 let mut crate_impl_blocks = CrateImplBlocks {
116 krate: krate.clone(), 116 krate,
117 impls: FxHashMap::default(), 117 impls: FxHashMap::default(),
118 impls_by_trait: FxHashMap::default(), 118 impls_by_trait: FxHashMap::default(),
119 }; 119 };