-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion for change #22073
base: master
Are you sure you want to change the base?
Suggestion for change #22073
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sharma-shray ,
Can you explain the intent of these changes? It is unclear to me.
// WARN: The paired `BufReader::consume` is not called intentionally. If we | ||
// do we'll chop a decent part of the potential gzip stream off. | ||
Ok(header_bytes.starts_with(GZIP_MAGIC)) | ||
if header_bytes.starts_with(GZIP_MAGIC) { | ||
r.consume(GZIP_MAGIC.len()); // To avoid interfering with the next read | ||
Ok(true) | ||
} else { | ||
Ok(false) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is wrong. is_gzipped
should just be checking if the stream is gzip and not consuming any bytes, as the comment says.
// Load the current state of the tables (this is a lock-free operation). | ||
let tables = tables.load(); | ||
match **tables { | ||
Some(ref tables) => { | ||
let mut tables = tables.iter().fold(String::from("("), |mut s, (key, _)| { | ||
s.push_str(key); | ||
s.push_str(", "); | ||
s | ||
}); | ||
|
||
tables.truncate(std::cmp::max(tables.len(), 0)); | ||
tables.push(')'); | ||
|
||
write!(f, "{} {}", name, tables) | ||
// Check if the tables are loaded or still in the loading state. | ||
match &**tables { | ||
Some(ref tables) => { | ||
// Map the keys to &str and join them with a comma. | ||
let table_names = tables | ||
.keys() | ||
.map(|s| s.as_str()) | ||
.collect::<Vec<_>>() | ||
.join(", "); | ||
write!(f, "{} ({})", name, table_names) | ||
} | ||
None => { | ||
// If the tables are still loading, indicate the loading state. | ||
write!(f, "{} loading", name) | ||
} | ||
None => write!(f, "{} loading", name), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the intent of this change?
Summary
Change Type
Is this a breaking change?
How did you test this PR?
Does this PR include user facing changes?
Checklist
Cargo.lock
), pleaserun
dd-rust-license-tool write
to regenerate the license inventory and commit the changes (if any). More details here.References