D22233: Code Simplification / Readability Changes

Kai Uwe Broulik noreply at phabricator.kde.org
Wed Jul 3 10:32:03 BST 2019


broulik added inline comments.

INLINE COMMENTS

> backtraceratingwidget.h:50
>  
> -    bool                            m_star1;
> -    bool                            m_star2;
> -    bool                            m_star3;
> -
> +    BacktraceParser::Usefulness     m_usefullness;
>      QPixmap                         m_errorPixmap;

`usefulness` with one L

> debugger.cpp:91
>  {
> -    if (!isValid() || !m_config->hasGroup(m_backend)) {
> -        return QString();
> -    } else {
> -        return m_config->group(m_backend).readPathEntry("Exec", QString());
> -    }
> +    return (isValid() && m_config->hasGroup(m_backend))
> +        ? m_config->group(m_backend).readPathEntry("Exec", QString())

I find early returns to be more readable. Maybe just remove the explicit `} else {` statement

> drkonqi.cpp:84
>  {
> -    static DrKonqi *drKonqiInstance = nullptr;
> -    if (!drKonqiInstance) {
> -        drKonqiInstance = new DrKonqi();
> -    }
> -    return drKonqiInstance;
> +    static DrKonqi drKonqiInstance;
> +    return &drKonqiInstance;

+1

REPOSITORY
  R871 DrKonqi

REVISION DETAIL
  https://phabricator.kde.org/D22233

To: tcanabrava
Cc: broulik, sitter, plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20190703/c51674b4/attachment.html>


More information about the Plasma-devel mailing list