You've already forked comprehensive-rust
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:
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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}}
|
||||
```
|
||||
|
||||
|
@ -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}}
|
||||
```
|
||||
|
Reference in New Issue
Block a user