"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/tools/rust-analyzer/crates/syntax/test_data/parser/fuzz-failures/0000.rs" between
rustc-1.57.0-src.tar.xz and rustc-1.58.0-src.tar.xz

About: Rust is a systems programming language that runs "blazingly fast, prevents nearly all segfaults, and guarantees thread safety" (developed by Mozilla).

0000.rs  (rustc-1.57.0-src.tar.xz):0000.rs  (rustc-1.58.0-src.tar.xz)
skipping to change at line 104 skipping to change at line 104
} }
pub /*(meh)*/ fn replace_range(mut text: String, range: TextRange, replace_with: &str) -> String { pub /*(meh)*/ fn replace_range(mut text: String, range: TextRange, replace_with: &str) -> String {
let start = u32::from(range.start()) as usize; let start = u32::from(range.start()) as usize;
let end = u32::from(range.end()) as usize; let end = u32::from(range.end()) as usize;
text.replace_range(start..end, replace_with); text.replace_range(start..end, replace_with);
text text
} }
fn is_balanced(tokens: &[Token]) -> bool { fn is_balanced(tokens: &[Token]) -> bool {
if tokens.len() == 0 if tokens.is_empty()
|| tokens.first().unwrap().kind != L_CURLY || tokens.first().unwrap().kind != L_CURLY
|| tokens.last().unwrap().kind != R_CURLY { || tokens.last().unwrap().kind != R_CURLY {
return false return false
} }
let mut balance = 0usize; let mut balance = 0usize;
for t in tokens.iter() { for t in tokens.iter() {
match t.kind { match t.kind {
L_CURLYt { L_CURLYt {
pub delete: TextRange, pub delete: TextRange,
pub insert: String, pub insert: String,
skipping to change at line 156 skipping to change at line 156
} }
pub /*(meh)*/ fn replace_range(mut text: String, range: TextRange, replace_with: &str) -> String { pub /*(meh)*/ fn replace_range(mut text: String, range: TextRange, replace_with: &str) -> String {
let start = u32::from(range.start()) as usize; let start = u32::from(range.start()) as usize;
let end = u32::from(range.end()) as usize; let end = u32::from(range.end()) as usize;
text.replace_range(start..end, replace_with); text.replace_range(start..end, replace_with);
text text
} }
fn is_balanced(tokens: &[Token]) -> bool { fn is_balanced(tokens: &[Token]) -> bool {
if tokens.len() == 0 if tokens.is_empty()
|| tokens.first().unwrap().kind != L_CURLY || tokens.first().unwrap().kind != L_CURLY
|| tokens.last().unwrap().kind != R_CURLY { || tokens.last().unwrap().kind != R_CURLY {
return false return false
} }
let mut balance = 0usize; let mut balance = 0usize;
for t in tokens.iter() { for t in tokens.iter() {
match t.kind { match t.kind {
L_CURLY => balance += 1, L_CURLY => balance += 1,
R_CURLY => balance = match balance.checked_sub(1) { R_CURLY => balance = match balance.checked_sub(1) {
Some(b) => b, Some(b) => b,
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)