From 251ffffc50a046634ac84a40cdde7731b54c02df Mon Sep 17 00:00:00 2001 From: Shamkhal Maharramov <9804406+Maharramoff@users.noreply.github.com> Date: Thu, 21 Mar 2019 01:28:30 +0400 Subject: [PATCH] Propose code-cleanups#2 (#253) Description of the changes: Remove redundancy Simplify if statements --- src/CalcManager/CalculatorHistory.cpp | 4 +--- src/CalcManager/CalculatorManager.cpp | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/CalcManager/CalculatorHistory.cpp b/src/CalcManager/CalculatorHistory.cpp index 7f6c406..31a1dae 100644 --- a/src/CalcManager/CalculatorHistory.cpp +++ b/src/CalcManager/CalculatorHistory.cpp @@ -34,15 +34,13 @@ unsigned int CalculatorHistory::AddToHistory(_In_ shared_ptr const &spHistoryItem) { - int lastIndex; - if (m_historyItems.size() >= m_maxHistorySize) { m_historyItems.erase(m_historyItems.begin()); } m_historyItems.push_back(spHistoryItem); - lastIndex = static_cast(m_historyItems.size() - 1); + unsigned int lastIndex = static_cast(m_historyItems.size() - 1); return lastIndex; } diff --git a/src/CalcManager/CalculatorManager.cpp b/src/CalcManager/CalculatorManager.cpp index 11b9258..b0cb699 100644 --- a/src/CalcManager/CalculatorManager.cpp +++ b/src/CalcManager/CalculatorManager.cpp @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #include "pch.h" @@ -360,7 +360,7 @@ namespace CalculationManager /// Serialized Rational of primary display void CalculatorManager::DeSerializePrimaryDisplay(const vector &serializedPrimaryDisplay) { - if (serializedPrimaryDisplay.size() == 0) + if (serializedPrimaryDisplay.empty()) { return; }