On Sun, Oct 04, 2020 at 07:27:28PM +0300, Yuriy Skalko wrote:
> @@ -4010,10 +4009,7 @@ InsetLabel const * Buffer::insetLabel(docstring const 
> & label,
>  
>  bool Buffer::activeLabel(docstring const & label) const
>  {
> -     if (!insetLabel(label, true))
> -             return false;
> -
> -     return true;
> +     return insetLabel(label, true) != nullptr;
>  }

...

> diff --git a/src/LyXVC.cpp b/src/LyXVC.cpp
> index 806d5e8143..9af9372cbe 100644
> --- a/src/LyXVC.cpp
> +++ b/src/LyXVC.cpp
> @@ -348,9 +348,7 @@ string LyXVC::toggleReadOnly()
>  
>  bool LyXVC::inUse() const
>  {
> -     if (vcs)
> -             return true;
> -     return false;
> +     return static_cast<bool>(vcs);
>  }

...

> diff --git a/src/Session.cpp b/src/Session.cpp
> index 3bb9c03a33..8fc8fa23d8 100644
> --- a/src/Session.cpp
> +++ b/src/Session.cpp
> @@ -494,10 +494,7 @@ void AuthFilesSection::write(ostream & os) const
>  
>  bool AuthFilesSection::find(string const & name) const
>  {
> -     if (auth_files_.find(name) != auth_files_.end())
> -             return true;
> -
> -     return false;
> +     return auth_files_.find(name) != auth_files_.end();
>  }
>  
>  
> @@ -547,10 +544,7 @@ bool ShellEscapeSection::find(string const & name) const
>  
>  bool ShellEscapeSection::findAuth(string const & name) const
>  {
> -     if (shellescape_files_.find(name + ",1") != shellescape_files_.end())
> -             return true;
> -
> -     return false;
> +     return shellescape_files_.find(name + ",1") != shellescape_files_.end();
>  }

....

> --- a/src/mathed/InsetMathFont.cpp
> +++ b/src/mathed/InsetMathFont.cpp
> @@ -58,9 +58,7 @@ InsetMath::mode_type InsetMathFont::currentMode() const
>  
>  bool InsetMathFont::lockedMode() const
>  {
> -     if (key_->extra == "forcetext")
> -             return true;
> -     return false;
> +     return key_->extra == "forcetext";
>  }
>  
>  
> +++ b/src/support/Package.cpp
> @@ -366,10 +366,7 @@ bool inBuildDir(FileName const & abs_binary,
>  bool doesFileExist(FileName & result, string const & search_dir, string 
> const & name)
>  {
>      result = fileSearch(search_dir, name);
> -    if (!result.empty()) {
> -        return true;
> -    }
> -    return false;
> +    return !result.empty();
>  }
>  

I admit that while those above are correct and more succint I do not find it 
more readable.
But YMMV, am I the only one?

Pavel
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to