• M
    Rollup merge of #67249 - ranma42:improve-starts-with-literal-char, r=BurntSushi · a6f817f4
    Mazdak Farrokhzad 提交于
    Improve code generated for `starts_with(<literal char>)`
    
    This PR includes two minor improvements to the code generated when checking for string prefix/suffix.
    
    The first commit simplifies the str/str operation, by taking advantage of the raw UTF-8 representation.
    
    The second commit replaces the current str/char matching logic with a char->str encoding and then the previous method.
    
    The resulting code should be equivalent in the generic case (one char is being encoded versus one char being decoded), but it becomes easy to optimize in the case of a literal char, which in most cases a developer might expect to be at least as simple as that of a literal string.
    
    This PR should fix #41993
    a6f817f4
pattern.rs 51.3 KB