Skip to content

Commit 1211dc8

Browse files
committed
Rust: Replace 'swift' with 'rust'.
1 parent f4758fe commit 1211dc8

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

docs/codeql/codeql-language-guides/basic-query-for-rust-code.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
.. _basic-query-for-swift-code:
1+
.. _basic-query-for-rust-code:
22

3-
Basic query for Swift code
3+
Basic query for Rust code
44
==========================
55

66
Learn to write and run a simple CodeQL query using Visual Studio Code with the CodeQL extension.
@@ -12,7 +12,7 @@ About the query
1212

1313
The query we're going to run performs a basic search of the code for ``if`` expressions that are redundant, in the sense that they have an empty ``then`` branch. For example, code such as:
1414

15-
.. code-block:: swift
15+
.. code-block:: rust
1616
1717
if error {
1818
// we should handle the error
@@ -29,20 +29,20 @@ Running a quick query
2929

3030
.. code-block:: ql
3131
32-
import swift
32+
import rust
3333
3434
from IfStmt ifStmt
3535
where ifStmt.getThen().(BraceStmt).getNumberOfElements() = 0
3636
select ifStmt, "This 'if' statement is redundant."
3737
3838
.. include:: ../reusables/vs-code-basic-instructions/run-quick-query-2.rst
3939

40-
.. image:: ../images/codeql-for-visual-studio-code/basic-swift-query-results-1.png
40+
.. image:: ../images/codeql-for-visual-studio-code/basic-rust-query-results-1.png
4141
:align: center
4242

4343
If any matching code is found, click a link in the ``ifStmt`` column to open the file and highlight the matching ``if`` statement.
4444

45-
.. image:: ../images/codeql-for-visual-studio-code/basic-swift-query-results-2.png
45+
.. image:: ../images/codeql-for-visual-studio-code/basic-rust-query-results-2.png
4646
:align: center
4747

4848
.. include:: ../reusables/vs-code-basic-instructions/note-store-quick-query.rst
@@ -55,7 +55,7 @@ After the initial ``import`` statement, this simple query comprises three parts
5555
+------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+
5656
| Query part | Purpose | Details |
5757
+==================================================================+===================================================================================================================+=================================================================================================+
58-
| ``import swift`` | Imports the standard CodeQL AST libraries for Swift. | Every query begins with one or more ``import`` statements. |
58+
| ``import rust`` | Imports the standard CodeQL AST libraries for Rust. | Every query begins with one or more ``import`` statements. |
5959
+------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------+
6060
| ``from IfStmt ifStmt`` | Defines the variables for the query. | We use: an ``IfStmt`` variable for ``if`` statements. |
6161
| | Declarations are of the form: | |
@@ -81,7 +81,7 @@ Remove false positive results
8181

8282
Browsing the results of our basic query shows that it could be improved. Among the results you are likely to find examples of ``if`` statements with an ``else`` branch, where an empty ``then`` branch does serve a purpose. For example:
8383

84-
.. code-block:: swift
84+
.. code-block:: rust
8585
8686
if (option == "-verbose") {
8787
// nothing to do - handled earlier
@@ -114,17 +114,17 @@ To exclude ``if`` statements that have an ``else`` branch:
114114
Further reading
115115
---------------
116116

117-
.. include:: ../reusables/swift-further-reading.rst
117+
.. include:: ../reusables/rust-further-reading.rst
118118
.. include:: ../reusables/codeql-ref-tools-further-reading.rst
119119

120120
.. Article-specific substitutions for the reusables used in docs/codeql/reusables/vs-code-basic-instructions
121121
122-
.. |language-text| replace:: Swift
122+
.. |language-text| replace:: Rust
123123

124-
.. |language-code| replace:: ``swift``
124+
.. |language-code| replace:: ``rust``
125125

126126
.. |example-url| replace:: https://github.com/alamofire/alamofire
127127

128-
.. |image-quick-query| image:: ../images/codeql-for-visual-studio-code/quick-query-tab-swift.png
128+
.. |image-quick-query| image:: ../images/codeql-for-visual-studio-code/quick-query-tab-rust.png
129129

130130
.. |result-col-1| replace:: The first column corresponds to the expression ``ifStmt`` and is linked to the location in the source code of the project where ``ifStmt`` occurs.

0 commit comments

Comments
 (0)