Monorepo for Tangled tangled.org
2

Configure Feed

Select the types of activity you want to include in your feed.

rustfmt: don't try to format autogened _lex

Lewis: May this revision serve well! <lewis@tangled.org>

author
Lewis
date (May 28, 2026, 10:02 AM +0300) commit 2a93a241 parent 52af2660 change-id oqwpvoon
+49 -33
+2
.tangled/workflows/fmt.yml
··· 7 7 steps: 8 8 - name: "Check formatting" 9 9 command: | 10 + mkdir -p bobbin/crates/types/src/_lex 11 + [ -f bobbin/crates/types/src/_lex/lib.rs ] || : > bobbin/crates/types/src/_lex/lib.rs 10 12 nix run .#fmt -- --ci
+8 -7
bobbin/crates/bobbin/src/main.rs
··· 247 247 ) 248 248 }); 249 249 250 - let debug_bind: Option<SocketAddr> = if cfg.server.debug_bind.is_empty() { 251 - None 252 - } else { 253 - Some(cfg.server.debug_bind.parse().with_context(|| { 254 - format!("invalid server.debug_bind `{}`", cfg.server.debug_bind) 255 - })?) 256 - }; 250 + let debug_bind: Option<SocketAddr> = 251 + if cfg.server.debug_bind.is_empty() { 252 + None 253 + } else { 254 + Some(cfg.server.debug_bind.parse().with_context(|| { 255 + format!("invalid server.debug_bind `{}`", cfg.server.debug_bind) 256 + })?) 257 + }; 257 258 let mem_probe = debug_bind.is_some().then(|| mem::MemProbe { 258 259 edges: edges.clone(), 259 260 search: search.clone(),
+26 -8
bobbin/crates/edge-index/src/lib.rs
··· 251 251 } 252 252 253 253 const BUCKET_CLASS_BOUNDS: [u64; 16] = [ 254 - 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 8192, 32768, 131072, u64::MAX, 254 + 1, 255 + 2, 256 + 4, 257 + 8, 258 + 16, 259 + 32, 260 + 64, 261 + 128, 262 + 256, 263 + 512, 264 + 1024, 265 + 2048, 266 + 8192, 267 + 32768, 268 + 131072, 269 + u64::MAX, 255 270 ]; 256 271 const BUCKET_CLASS_COUNT: usize = BUCKET_CLASS_BOUNDS.len(); 257 272 ··· 264 279 265 280 impl EdgeMemReport { 266 281 pub fn bucket_histogram(&self) -> impl Iterator<Item = (u64, u64)> { 267 - BUCKET_CLASS_BOUNDS.into_iter().zip(self.bucket_size_classes) 282 + BUCKET_CLASS_BOUNDS 283 + .into_iter() 284 + .zip(self.bucket_size_classes) 268 285 } 269 286 } 270 287 ··· 347 364 } 348 365 } 349 366 Self::Large(big) => { 350 - if big.keys.remove(key) && let Some(a) = author { 367 + if big.keys.remove(key) 368 + && let Some(a) = author 369 + { 351 370 drop_author(&mut big.authors, a); 352 371 } 353 372 } ··· 675 694 .and_then(|id| { 676 695 self.forward.read_sync(&id, |_, sources| { 677 696 let init = ScanState::with_capacity(limit_usize + 1); 678 - let outcome = sources.directed(cursor, dir).try_fold( 679 - init, 680 - |mut state, key| { 697 + let outcome = sources 698 + .directed(cursor, dir) 699 + .try_fold(init, |mut state, key| { 681 700 if state.scanned >= scan_cap && state.matched.len() <= limit_usize { 682 701 return ControlFlow::Break(state); 683 702 } ··· 695 714 } 696 715 } 697 716 ControlFlow::Continue(state) 698 - }, 699 - ); 717 + }); 700 718 let (state, bucket_exhausted) = match outcome { 701 719 ControlFlow::Continue(s) => (s, true), 702 720 ControlFlow::Break(s) => (s, false),
+7 -11
bobbin/crates/edge-index/tests/bucket_scaling.rs
··· 21 21 22 22 fn vec_shift_work(keys: &[Key]) -> u128 { 23 23 let mut sorted: Vec<Key> = Vec::with_capacity(keys.len()); 24 - keys.iter().fold(0u128, |moves, &key| { 25 - match sorted.binary_search(&key) { 24 + keys.iter() 25 + .fold(0u128, |moves, &key| match sorted.binary_search(&key) { 26 26 Ok(_) => moves, 27 27 Err(pos) => { 28 28 let displaced = (sorted.len() - pos) as u128; 29 29 sorted.insert(pos, key); 30 30 moves + displaced 31 31 } 32 - } 33 - }) 32 + }) 34 33 } 35 34 36 35 thread_local! { ··· 63 62 } 64 63 65 64 fn doubling_ratios(work: &[u128]) -> Vec<f64> { 66 - work.windows(2) 67 - .map(|w| w[1] as f64 / w[0] as f64) 68 - .collect() 65 + work.windows(2).map(|w| w[1] as f64 / w[0] as f64).collect() 69 66 } 70 67 71 68 #[test] ··· 120 117 fn vec_remove_work(keys: &[Key]) -> u128 { 121 118 let mut sorted: Vec<Key> = keys.to_vec(); 122 119 sorted.sort_unstable(); 123 - keys.iter().fold(0u128, |moves, key| { 124 - match sorted.binary_search(key) { 120 + keys.iter() 121 + .fold(0u128, |moves, key| match sorted.binary_search(key) { 125 122 Ok(pos) => { 126 123 let displaced = (sorted.len() - pos - 1) as u128; 127 124 sorted.remove(pos); 128 125 moves + displaced 129 126 } 130 127 Err(_) => moves, 131 - } 132 - }) 128 + }) 133 129 } 134 130 135 131 fn btree_remove_work(keys: &[Key]) -> u128 {
+1 -4
bobbin/crates/record-lru/src/lib.rs
··· 99 99 Payload::Raw(bytes) => bytes.len(), 100 100 Payload::Zstd { compressed, .. } => compressed.len(), 101 101 }; 102 - ENTRY_OVERHEAD 103 - + payload as u64 104 - + key.as_ref().len() as u64 105 - + val.cid.as_ref().len() as u64 102 + ENTRY_OVERHEAD + payload as u64 + key.as_ref().len() as u64 + val.cid.as_ref().len() as u64 106 103 } 107 104 } 108 105
+5 -1
bobbin/crates/xrpc/tests/aggregation.rs
··· 767 767 ) 768 768 .await; 769 769 assert_eq!(status, StatusCode::OK); 770 - assert_eq!(body["items"].as_array().unwrap().len(), 1, "gone item dropped from the page"); 770 + assert_eq!( 771 + body["items"].as_array().unwrap().len(), 772 + 1, 773 + "gone item dropped from the page" 774 + ); 771 775 772 776 let (cstatus, cbody) = json_response( 773 777 app.oneshot(list_request(
-2
bobbin/default.nix
··· 4 4 tangled, 5 5 ... 6 6 }: 7 - 8 7 rustPlatform.buildRustPackage { 9 8 pname = "bobbin"; 10 9 version = "main"; ··· 33 32 mainProgram = "bobbin"; 34 33 }; 35 34 } 36 -