diff options
| author | bors <bors@rust-lang.org> | 2020-07-20 10:19:58 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-07-20 10:19:58 +0000 |
| commit | 71384101ea3b030b80f7def80a37f67e148518b0 (patch) | |
| tree | b2cdb190bf396f3b8fc7ffb65e6b0145d27bfd9d /src/liballoc/string.rs | |
| parent | 05630b06fdf76c25c6ccf2e9ac3567592eae6c67 (diff) | |
| parent | 76b8420168a2e14abf025a07ee4e32d87956d940 (diff) | |
| download | rust-71384101ea3b030b80f7def80a37f67e148518b0.tar.gz rust-71384101ea3b030b80f7def80a37f67e148518b0.zip | |
Auto merge of #74010 - pierwill:pierwill-o-notation, r=GuillaumeGomez
Use italics for O notation In documentation, I think it makes sense to italicize O notation (*O(n)*) as opposed to using back-ticks (`O(n)`). Visually, back-ticks focus the reader on the literal characters being used, making them ideal for representing code. Using italics, as far I can tell, more closely follows typographic conventions in mathematics and computer science. Just a suggestion, of course! 😇
Diffstat (limited to 'src/liballoc/string.rs')
| -rw-r--r-- | src/liballoc/string.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index 1c3879c40c2..15f10df9a45 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -1162,7 +1162,7 @@ impl String { /// Removes a [`char`] from this `String` at a byte position and returns it. /// - /// This is an `O(n)` operation, as it requires copying every element in the + /// This is an *O*(*n*) operation, as it requires copying every element in the /// buffer. /// /// # Panics @@ -1262,7 +1262,7 @@ impl String { /// Inserts a character into this `String` at a byte position. /// - /// This is an `O(n)` operation as it requires copying every element in the + /// This is an *O*(*n*) operation as it requires copying every element in the /// buffer. /// /// # Panics @@ -1309,7 +1309,7 @@ impl String { /// Inserts a string slice into this `String` at a byte position. /// - /// This is an `O(n)` operation as it requires copying every element in the + /// This is an *O*(*n*) operation as it requires copying every element in the /// buffer. /// /// # Panics @@ -1971,7 +1971,7 @@ impl hash::Hash for String { /// /// This consumes the `String` on the left-hand side and re-uses its buffer (growing it if /// necessary). This is done to avoid allocating a new `String` and copying the entire contents on -/// every operation, which would lead to `O(n^2)` running time when building an `n`-byte string by +/// every operation, which would lead to *O*(*n*^2) running time when building an *n*-byte string by /// repeated concatenation. /// /// The string on the right-hand side is only borrowed; its contents are copied into the returned |
