Browse Source

Shell: Use starts_with() in expand_parameters

This reads a little nicer, and makes us care less about an empty String
Shannon Booth 5 years ago
parent
commit
1ef3d4af69
1 changed files with 1 additions and 2 deletions
  1. 1 2
      Shell/main.cpp

+ 1 - 2
Shell/main.cpp

@@ -700,8 +700,7 @@ static Vector<String> expand_globs(const StringView& path, const StringView& bas
 
 static Vector<String> expand_parameters(const StringView& param)
 {
-    bool is_variable = param.length() > 1 && param[0] == '$';
-    if (!is_variable)
+    if (!param.starts_with('$'))
         return { param };
 
     String variable_name = String(param.substring_view(1, param.length() - 1));