1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-17 06:37:34 +02:00

Trim off licenses when showing solutions (#1212)

The licenses end up in the PO files, causing extra unnecessary for work
our translators. We save about 300 lines from each PO file with this.

This also solves another small problem: when a file is included with an
anchor, other anchors are automatically stripped away. This removes some
confusing `// ANCHOR: foo` and `// ANCHOR_END: foo` lines in the
solutions.
This commit is contained in:
Martin Geisler
2023-09-18 11:56:55 +02:00
committed by GitHub
parent fd0678f38e
commit 991c437986
26 changed files with 30 additions and 20 deletions

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// ANCHOR: solution
// ANCHOR: setup
use futures_util::stream::StreamExt;
use futures_util::SinkExt;

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// ANCHOR: solution
// ANCHOR: setup
use futures_util::sink::SinkExt;
use futures_util::stream::StreamExt;

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// ANCHOR: solution
// ANCHOR: Philosopher
use std::sync::Arc;
use tokio::time;

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// ANCHOR: solution
// ANCHOR: Philosopher
use std::sync::{mpsc, Arc, Mutex};
use std::thread;

View File

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// ANCHOR: solution
use std::{sync::Arc, sync::Mutex, sync::mpsc, thread};
// ANCHOR: setup

View File

@ -5,7 +5,7 @@
([back to exercise](dining-philosophers-async.md))
```rust,compile_fail
{{#include dining-philosophers-async.rs}}
{{#include dining-philosophers-async.rs:solution}}
```
## Broadcast Chat Application
@ -15,12 +15,12 @@
`src/bin/server.rs`:
```rust,compile_fail
{{#include chat-async/src/bin/server.rs}}
{{#include chat-async/src/bin/server.rs:solution}}
```
`src/bin/client.rs`:
```rust,compile_fail
{{#include chat-async/src/bin/client.rs}}
{{#include chat-async/src/bin/client.rs:solution}}
```

View File

@ -5,7 +5,7 @@
([back to exercise](dining-philosophers.md))
```rust
{{#include dining-philosophers.rs}}
{{#include dining-philosophers.rs:solution}}
```
## Link Checker
@ -13,5 +13,5 @@
([back to exercise](link-checker.md))
```rust,compile_fail
{{#include link-checker.rs}}
{{#include link-checker.rs:solution}}
```