File: rand-0.8.patch

package info (click to toggle)
rust-rustyline 17.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,032 kB
  • sloc: makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,485 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
This patch is based on a revert of upstream commit
fbfe56b92aa67d96f164d915c357aacf695aa55c adapted for use in the Debian
package by Peter Michael Green.

Index: rustyline/examples/external_print.rs
===================================================================
--- rustyline.orig/examples/external_print.rs
+++ rustyline/examples/external_print.rs
@@ -1,7 +1,7 @@
 use std::thread;
 use std::time::Duration;
 
-use rand::{rng, Rng};
+use rand::{thread_rng, Rng};
 
 use rustyline::{DefaultEditor, ExternalPrinter, Result};
 
@@ -9,13 +9,13 @@ fn main() -> Result<()> {
     let mut rl = DefaultEditor::new()?;
     let mut printer = rl.create_external_printer()?;
     thread::spawn(move || {
-        let mut rng = rng();
+        let mut rng = thread_rng();
         let mut i = 0usize;
         loop {
             printer
                 .print(format!("External message #{i}"))
                 .expect("External print failure");
-            let wait_ms = rng.random_range(1000..10000);
+            let wait_ms = rng.gen_range(1000..10000);
             thread::sleep(Duration::from_millis(wait_ms));
             i += 1;
         }
Index: rustyline/Cargo.toml
===================================================================
--- rustyline.orig/Cargo.toml
+++ rustyline/Cargo.toml
@@ -186,7 +186,7 @@ version = "0.11"
 default-features = false
 
 [dev-dependencies.rand]
-version = "0.9"
+version = ">= 0.8.5, < 0.10"
 
 [dev-dependencies.tempfile]
 version = "3.1.0"