Small code simplifications
ClosedPublic

Authored by tcanabrava on Apr 10 2019, 3:03 PM.

Details

Summary
  • remove clang 9 warnings
  • simplify if / else branches

Diff Detail

Repository
R319 Konsole
Branch
simplify_bookmark_handler
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 10700
Build 10718: arc lint + arc unit
tcanabrava created this revision.Apr 10 2019, 3:03 PM
Restricted Application added a project: Konsole. · View Herald TranscriptApr 10 2019, 3:03 PM
Restricted Application added a subscriber: konsole-devel. · View Herald Transcript
tcanabrava requested review of this revision.Apr 10 2019, 3:03 PM
ngraham added inline comments.
src/BookmarkHandler.cpp
105

Why not an empty QUrl()?

145

Why not an empty QString()?

{}; means “default value of the return type”, so I’m retirning a QUrl()
where it’s supposed to be a QUrl, and a QString where it’s supposed to be a
string.

This is more future proof as if we change the type of the function we don’t
need to change that return.

Em qua, 10 de abr de 2019 às 19:21, Nathaniel Graham <
noreply@phabricator.kde.org> escreveu:

ngraham added inline comments. View Revision
https://phabricator.kde.org/D20438
*INLINE COMMENTS*
View Inline https://phabricator.kde.org/D20438#inline-114927
BookmarkHandler.cpp:105
}
return {};
}

Why not an empty QUrl()?

View Inline https://phabricator.kde.org/D20438#inline-114928
BookmarkHandler.cpp:145
}
return {};
}

Why not an empty QString()?

*REPOSITORY*
R319 Konsole

*REVISION DETAIL*
https://phabricator.kde.org/D20438

*To: *tcanabrava, Konsole, hindenburg
*Cc: *ngraham, konsole-devel, gennad, thsurrel, maximilianocuria,
hindenburg

ahmedbilal added inline comments.
src/BookmarkHandler.cpp
105

The author is trying to use return {} feature in C++ 11. However, QUrl() is more explicit for those who does or doesn't know about the previously mentioned feature.

Explicit is better then Implicit.

ngraham accepted this revision.Apr 10 2019, 6:17 PM

Ah, clever.

This revision is now accepted and ready to land.Apr 10 2019, 6:17 PM
This revision was automatically updated to reflect the committed changes.