diff --git a/src/builtins/source.rs b/src/builtins/source.rs index f58867747..6339d94f0 100644 --- a/src/builtins/source.rs +++ b/src/builtins/source.rs @@ -83,7 +83,7 @@ pub fn source(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> O 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 // 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 }..]; @@ -105,7 +105,5 @@ pub fn source(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> O retval = parser.get_last_status(); } - // Do not close fd after calling reader_read. reader_read automatically closes it before calling - // eval. Some(retval) } diff --git a/src/common.rs b/src/common.rs index 025ab99b2..3d69408ab 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1942,8 +1942,8 @@ pub trait Named { fn name(&self) -> &'static wstr; } -/// Return a pointer to the first entry with the given name, assuming the entries are sorted by -/// name. Return nullptr if not found. +/// Return a reference to the first entry with the given name, assuming the entries are sorted by +/// name. Return None if not found. pub fn get_by_sorted_name(name: &wstr, vals: &'static [T]) -> Option<&'static T> { match vals.binary_search_by_key(&name, |val| val.name()) { Ok(index) => Some(&vals[index]), diff --git a/src/parser.rs b/src/parser.rs index 6014e093d..b6ca73835 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -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 { block.src_lineno = self.get_lineno(); block.src_filename = self.current_filename(); diff --git a/src/screen.rs b/src/screen.rs index 8eff0f5e7..479622198 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -1363,8 +1363,7 @@ impl LayoutCache { } } - /// Finds the layout for a prompt, promoting it to the front. Returns nullptr if not found. - /// Note this points into our cache; do not modify the cache while the pointer lives. + /// Finds the layout for a prompt, promoting it to the front. Returns whether this was found. /// Exposed for testing. pub fn find_prompt_layout( &mut self,