diff options
author | sin-ack <sin-ack@users.noreply.github.com> | 2022-07-11 20:10:18 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-12 23:11:35 +0200 |
commit | c8585b77d263d15807231cb8bd1345d2591b9495 (patch) | |
tree | ac3c44a6f7d6fad59b942809d67b92826386b25c /Userland/DevTools/HackStudio | |
parent | 3f3f45580ab7266258e97cb3cecf1e24716d61c5 (diff) | |
download | serenity-c8585b77d263d15807231cb8bd1345d2591b9495.zip |
Everywhere: Replace single-char StringView op. arguments with chars
This prevents us from needing a sv suffix, and potentially reduces the
need to run generic code for a single character (as contains,
starts_with, ends_with etc. for a char will be just a length and
equality check).
No functional changes.
Diffstat (limited to 'Userland/DevTools/HackStudio')
-rw-r--r-- | Userland/DevTools/HackStudio/Debugger/Debugger.cpp | 2 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp | 2 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/HackStudioWidget.cpp | 6 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/Language.cpp | 4 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/ProjectBuilder.cpp | 2 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/main.cpp | 2 |
6 files changed, 9 insertions, 9 deletions
diff --git a/Userland/DevTools/HackStudio/Debugger/Debugger.cpp b/Userland/DevTools/HackStudio/Debugger/Debugger.cpp index 314333626c..267c155dc8 100644 --- a/Userland/DevTools/HackStudio/Debugger/Debugger.cpp +++ b/Userland/DevTools/HackStudio/Debugger/Debugger.cpp @@ -94,7 +94,7 @@ bool Debugger::set_execution_position(String const& file, size_t line) Debug::DebugInfo::SourcePosition Debugger::create_source_position(String const& file, size_t line) { - if (file.starts_with("/")) + if (file.starts_with('/')) return { file, line + 1 }; return { LexicalPath::canonicalized_path(String::formatted("{}/{}", m_source_root, file)), line + 1 }; } diff --git a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp index aab3375734..e67e39a535 100644 --- a/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp +++ b/Userland/DevTools/HackStudio/Dialogs/NewProjectDialog.cpp @@ -161,7 +161,7 @@ Optional<String> NewProjectDialog::get_available_project_name() Optional<String> NewProjectDialog::get_project_full_path() { // Do not permit forward-slashes in project names - if (m_name_input->text().contains("/")) + if (m_name_input->text().contains('/')) return {}; auto create_in = m_create_in_input->text(); diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index b75de6ab22..4dda8feae5 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -619,7 +619,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_copy_relative_path_action() auto copy_relative_path_action = GUI::Action::create("Copy &Relative Path", [this](const GUI::Action&) { auto paths = selected_file_paths(); VERIFY(!paths.is_empty()); - auto paths_string = String::join("\n", paths); + auto paths_string = String::join('\n', paths); GUI::Clipboard::the().set_plain_text(paths_string); }); copy_relative_path_action->set_enabled(true); @@ -636,7 +636,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_copy_full_path_action() Vector<String> full_paths; for (auto& path : paths) full_paths.append(get_absolute_path(path)); - auto paths_string = String::join("\n", full_paths); + auto paths_string = String::join('\n', full_paths); GUI::Clipboard::the().set_plain_text(paths_string); }); copy_full_path_action->set_enabled(true); @@ -1086,7 +1086,7 @@ String HackStudioWidget::get_full_path_of_serenity_source(String const& file) path_parts.remove(0); } StringBuilder relative_path_builder; - relative_path_builder.join("/", path_parts); + relative_path_builder.join('/', path_parts); constexpr char SERENITY_LIBS_PREFIX[] = "/usr/src/serenity"; LexicalPath serenity_sources_base(SERENITY_LIBS_PREFIX); return String::formatted("{}/{}", serenity_sources_base, relative_path_builder.to_string()); diff --git a/Userland/DevTools/HackStudio/Language.cpp b/Userland/DevTools/HackStudio/Language.cpp index bc6fc82f34..794297da9f 100644 --- a/Userland/DevTools/HackStudio/Language.cpp +++ b/Userland/DevTools/HackStudio/Language.cpp @@ -15,7 +15,7 @@ Language language_from_file(LexicalPath const& file) return Language::GitCommit; auto extension = file.extension(); - VERIFY(!extension.starts_with(".")); + VERIFY(!extension.starts_with('.')); if (extension == "c" || extension == "cc" || extension == "cxx" || extension == "cpp" || extension == "c++" || extension == "h" || extension == "hh" || extension == "hxx" || extension == "hpp" || extension == "h++") return Language::Cpp; @@ -57,7 +57,7 @@ String language_name_from_file(LexicalPath const& file) return "GitCommit"; auto extension = file.extension(); - VERIFY(!extension.starts_with(".")); + VERIFY(!extension.starts_with('.')); if (extension == "c" || extension == "cc" || extension == "cxx" || extension == "cpp" || extension == "c++" || extension == "h" || extension == "hh" || extension == "hxx" || extension == "hpp" || extension == "h++") return "C++"; diff --git a/Userland/DevTools/HackStudio/ProjectBuilder.cpp b/Userland/DevTools/HackStudio/ProjectBuilder.cpp index 4abacd8685..69a66eb1bf 100644 --- a/Userland/DevTools/HackStudio/ProjectBuilder.cpp +++ b/Userland/DevTools/HackStudio/ProjectBuilder.cpp @@ -246,7 +246,7 @@ void ProjectBuilder::for_each_library_dependencies(Function<void(String, Vector< auto library_name = result.capture_group_matches.at(0).at(0).view.string_view(); auto dependencies_string = result.capture_group_matches.at(0).at(1).view.string_view(); - func(library_name, dependencies_string.split_view(" ")); + func(library_name, dependencies_string.split_view(' ')); } } diff --git a/Userland/DevTools/HackStudio/main.cpp b/Userland/DevTools/HackStudio/main.cpp index 69b8f80fd0..ffa24f801f 100644 --- a/Userland/DevTools/HackStudio/main.cpp +++ b/Userland/DevTools/HackStudio/main.cpp @@ -127,7 +127,7 @@ static void update_path_environment_variable() path.append({ path_env_ptr, strlen(path_env_ptr) }); if (path.length()) - path.append(":"); + path.append(':'); path.append("/usr/local/sbin:/usr/local/bin:/usr/bin:/bin"sv); setenv("PATH", path.to_string().characters(), true); } |