changeset 538:6887e24fd83f

use eprintln instead of println
author Lewin Bormann <lbo@spheniscida.de>
date Tue, 27 Jul 2021 09:56:48 +0200
parents 320a736a5a7a
children 4b0278ca5158
files coverage.sh examples/leveldb-tool/src/main.rs src/db_impl.rs src/db_iter.rs src/memtable.rs src/merging_iter.rs src/skipmap.rs src/write_batch.rs
diffstat 8 files changed, 22 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/coverage.sh	Tue Jul 27 09:56:05 2021 +0200
+++ b/coverage.sh	Tue Jul 27 09:56:48 2021 +0200
@@ -1,4 +1,5 @@
 #!/bin/bash
+set -x
 
 KCOV=kcov
 KCOV_OPTS="--exclude-pattern=/.cargo,/glibc,/usr/lib,/usr/include"
--- a/examples/leveldb-tool/src/main.rs	Tue Jul 27 09:56:05 2021 +0200
+++ b/examples/leveldb-tool/src/main.rs	Tue Jul 27 09:56:48 2021 +0200
@@ -10,12 +10,12 @@
     match db.get(k.as_bytes()) {
         Some(v) => {
             if let Ok(s) = String::from_utf8(v.clone()) {
-                println!("{} => {}", k, s);
+                eprintln!("{} => {}", k, s);
             } else {
-                println!("{} => {:?}", k, v);
+                eprintln!("{} => {:?}", k, v);
             }
         }
-        None => println!("{} => <not found>", k),
+        None => eprintln!("{} => <not found>", k),
     }
 }
 
--- a/src/db_impl.rs	Tue Jul 27 09:56:05 2021 +0200
+++ b/src/db_impl.rs	Tue Jul 27 09:56:48 2021 +0200
@@ -1193,7 +1193,7 @@
             opt.reuse_manifest = false;
             let _ = DB::open("otherdb", opt.clone()).unwrap();
 
-            println!(
+            eprintln!(
                 "children after: {:?}",
                 env.children(Path::new("otherdb/")).unwrap()
             );
@@ -1209,7 +1209,7 @@
             opt.reuse_manifest = true;
             let mut db = DB::open("db", opt.clone()).unwrap();
 
-            println!(
+            eprintln!(
                 "children after: {:?}",
                 env.children(Path::new("db/")).unwrap()
             );
@@ -1224,7 +1224,7 @@
         }
 
         {
-            println!(
+            eprintln!(
                 "children before: {:?}",
                 env.children(Path::new("db/")).unwrap()
             );
@@ -1233,7 +1233,7 @@
             opt.reuse_logs = false;
             let mut db = DB::open("db", opt.clone()).unwrap();
 
-            println!(
+            eprintln!(
                 "children after: {:?}",
                 env.children(Path::new("db/")).unwrap()
             );
@@ -1263,7 +1263,7 @@
         }
 
         {
-            println!(
+            eprintln!(
                 "children before: {:?}",
                 env.children(Path::new("db/")).unwrap()
             );
@@ -1273,7 +1273,7 @@
             opt.reuse_logs = true;
             let db = DB::open("db", opt).unwrap();
 
-            println!(
+            eprintln!(
                 "children after: {:?}",
                 env.children(Path::new("db/")).unwrap()
             );
@@ -1301,12 +1301,12 @@
         let (mut db, opt) = build_db();
         let env = &opt.env;
 
-        println!(
+        eprintln!(
             "children before: {:?}",
             env.children(Path::new("db/")).unwrap()
         );
         db.compact_range(b"aaa", b"dba").unwrap();
-        println!(
+        eprintln!(
             "children after: {:?}",
             env.children(Path::new("db/")).unwrap()
         );
@@ -1337,12 +1337,12 @@
 
         db.put(b"xxx", b"123").unwrap();
 
-        println!(
+        eprintln!(
             "children before: {:?}",
             env.children(Path::new("db/")).unwrap()
         );
         db.compact_range(b"aaa", b"dba").unwrap();
-        println!(
+        eprintln!(
             "children after: {:?}",
             env.children(Path::new("db/")).unwrap()
         );
@@ -1430,7 +1430,7 @@
             assert_eq!(
                 5,
                 LdbIteratorIter::wrap(&mut tbl.iter())
-                    .map(|v| println!("{:?}", v))
+                    .map(|v| eprintln!("{:?}", v))
                     .count()
             );
         }
@@ -1545,7 +1545,7 @@
         db.imm = Some(imm);
         db.compact_memtable().unwrap();
 
-        println!(
+        eprintln!(
             "children after: {:?}",
             db.opt.env.children(Path::new("db/")).unwrap()
         );
--- a/src/db_iter.rs	Tue Jul 27 09:56:05 2021 +0200
+++ b/src/db_iter.rs	Tue Jul 27 09:56:48 2021 +0200
@@ -391,7 +391,7 @@
         ];
 
         for (k, v) in keys.iter().zip(vals.iter()) {
-            println!("{:?}", String::from_utf8(k.to_vec()).unwrap());
+            eprintln!("{:?}", String::from_utf8(k.to_vec()).unwrap());
             iter.seek(k);
             assert_eq!((k.to_vec(), v.to_vec()), current_key_val(&iter).unwrap());
         }
--- a/src/memtable.rs	Tue Jul 27 09:56:05 2021 +0200
+++ b/src/memtable.rs	Tue Jul 27 09:56:48 2021 +0200
@@ -217,12 +217,12 @@
 
         // Smaller sequence number doesn't find entry
         if let Some(v) = mt.get(&LookupKey::new("abc".as_bytes(), 110)).0 {
-            println!("{:?}", v);
+            eprintln!("{:?}", v);
             panic!("found");
         }
 
         if let Some(v) = mt.get(&LookupKey::new("abf".as_bytes(), 110)).0 {
-            println!("{:?}", v);
+            eprintln!("{:?}", v);
             panic!("found");
         }
 
--- a/src/merging_iter.rs	Tue Jul 27 09:56:05 2021 +0200
+++ b/src/merging_iter.rs	Tue Jul 27 09:56:48 2021 +0200
@@ -286,7 +286,7 @@
         let second = miter.next();
         // -> abc
         let third = miter.next();
-        println!("{:?} {:?} {:?}", first, second, third);
+        eprintln!("{:?} {:?} {:?}", first, second, third);
 
         assert!(first != third);
         // abb <-
--- a/src/skipmap.rs	Tue Jul 27 09:56:05 2021 +0200
+++ b/src/skipmap.rs	Tue Jul 27 09:56:48 2021 +0200
@@ -270,7 +270,7 @@
         let mut current = self.head.as_ref() as *const Node;
         loop {
             unsafe {
-                println!(
+                eprintln!(
                     "{:?} {:?}/{:?} - {:?}",
                     current,
                     (*current).key,
--- a/src/write_batch.rs	Tue Jul 27 09:56:05 2021 +0200
+++ b/src/write_batch.rs	Tue Jul 27 09:56:48 2021 +0200
@@ -167,7 +167,7 @@
             }
         }
 
-        println!("{:?}", b.entries);
+        eprintln!("{:?}", b.entries);
         assert_eq!(b.byte_size(), 49);
         assert_eq!(b.iter().count(), 5);