From 37ba237e6686d94783d1f025d23823ad7c0cb0c8 Mon Sep 17 00:00:00 2001 From: Marcus Klaas de Vries Date: Mon, 14 Jan 2019 21:52:08 +0100 Subject: Address issues found in review --- crates/ra_hir/src/expr.rs | 18 ++++++++---------- crates/ra_hir/src/ty.rs | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/src/expr.rs b/crates/ra_hir/src/expr.rs index 2696592a4..5081466a2 100644 --- a/crates/ra_hir/src/expr.rs +++ b/crates/ra_hir/src/expr.rs @@ -661,22 +661,20 @@ impl ExprCollector { .map(|s| Name::new(s)) .and_then(|name| UncertainIntTy::from_name(&name)); - if let Some(kn) = known_name { - Literal::Int(Default::default(), kn) - } else { - Literal::Int(Default::default(), UncertainIntTy::Unknown) - } + Literal::Int( + Default::default(), + known_name.unwrap_or(UncertainIntTy::Unknown), + ) } LiteralFlavor::FloatNumber { suffix } => { let known_name = suffix .map(|s| Name::new(s)) .and_then(|name| UncertainFloatTy::from_name(&name)); - if let Some(kn) = known_name { - Literal::Float(Default::default(), kn) - } else { - Literal::Float(Default::default(), UncertainFloatTy::Unknown) - } + Literal::Float( + Default::default(), + known_name.unwrap_or(UncertainFloatTy::Unknown), + ) } LiteralFlavor::ByteString => Literal::ByteString(Default::default()), LiteralFlavor::String => Literal::String(Default::default()), diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs index b6577ee5e..5579db8fb 100644 --- a/crates/ra_hir/src/ty.rs +++ b/crates/ra_hir/src/ty.rs @@ -107,7 +107,7 @@ impl UnifyValue for TypeVarValue { } } -/// The kinds of placeholders we need during type inference. There's seperate +/// The kinds of placeholders we need during type inference. There's separate /// values for general types, and for integer and float variables. The latter /// two are used for inference of literal values (e.g. `100` could be one of /// several integer types). -- cgit v1.2.3