Clean up some stale comments

This commit is contained in:
Peter Ammon 2024-12-03 09:36:06 -08:00
parent fcf8ed0628
commit 0b68fbfd85
No known key found for this signature in database
4 changed files with 5 additions and 8 deletions

View File

@ -83,7 +83,7 @@ pub fn source(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> O
Some(func_filename.clone()), Some(func_filename.clone()),
); );
// Construct argv from our null-terminated list. // Construct argv for the sourced file from our remaining args.
// This is slightly subtle. If this is a bare `source` with no args then `argv + optind` already // This is slightly subtle. If this is a bare `source` with no args then `argv + optind` already
// points to the end of argv. Otherwise we want to skip the file name to get to the args if any. // points to the end of argv. Otherwise we want to skip the file name to get to the args if any.
let remaining_args = &args[optind + if argc == optind { 0 } else { 1 }..]; let remaining_args = &args[optind + if argc == optind { 0 } else { 1 }..];
@ -105,7 +105,5 @@ pub fn source(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> O
retval = parser.get_last_status(); retval = parser.get_last_status();
} }
// Do not close fd after calling reader_read. reader_read automatically closes it before calling
// eval.
Some(retval) Some(retval)
} }

View File

@ -1942,8 +1942,8 @@ pub trait Named {
fn name(&self) -> &'static wstr; fn name(&self) -> &'static wstr;
} }
/// Return a pointer to the first entry with the given name, assuming the entries are sorted by /// Return a reference to the first entry with the given name, assuming the entries are sorted by
/// name. Return nullptr if not found. /// name. Return None if not found.
pub fn get_by_sorted_name<T: Named>(name: &wstr, vals: &'static [T]) -> Option<&'static T> { pub fn get_by_sorted_name<T: Named>(name: &wstr, vals: &'static [T]) -> Option<&'static T> {
match vals.binary_search_by_key(&name, |val| val.name()) { match vals.binary_search_by_key(&name, |val| val.name()) {
Ok(index) => Some(&vals[index]), Ok(index) => Some(&vals[index]),

View File

@ -860,7 +860,7 @@ impl Parser {
} }
} }
/// Pushes a new block. Returns a pointer to the block, stored in the parser. /// Pushes a new block. Returns an id (index) of the block, which is stored in the parser.
pub fn push_block(&self, mut block: Block) -> BlockId { pub fn push_block(&self, mut block: Block) -> BlockId {
block.src_lineno = self.get_lineno(); block.src_lineno = self.get_lineno();
block.src_filename = self.current_filename(); block.src_filename = self.current_filename();

View File

@ -1363,8 +1363,7 @@ impl LayoutCache {
} }
} }
/// Finds the layout for a prompt, promoting it to the front. Returns nullptr if not found. /// Finds the layout for a prompt, promoting it to the front. Returns whether this was found.
/// Note this points into our cache; do not modify the cache while the pointer lives.
/// Exposed for testing. /// Exposed for testing.
pub fn find_prompt_layout( pub fn find_prompt_layout(
&mut self, &mut self,