@@ -82,7 +82,7 @@ fn format_values(x: SEXP, format_options: &FormatOptions) -> anyhow::Result<Vec<
82
82
}
83
83
84
84
fn format_object ( x : SEXP ) -> Vec < FormattedValue > {
85
- // we call r_format() to dispatch the format method
85
+ // We call r_format() to dispatch the format method
86
86
let formatted: Vec < String > = match r_format ( x) {
87
87
Ok ( fmt) => match RObject :: from ( fmt) . try_into ( ) {
88
88
Ok ( x) => x,
@@ -91,8 +91,8 @@ fn format_object(x: SEXP) -> Vec<FormattedValue> {
91
91
Err ( _) => return unknown_format ( x) ,
92
92
} ;
93
93
94
- // but we also want to show special value codes. we call base::is.na() to dispatch
95
- // the is.na() function and then replace those with FormattedValues::NA.
94
+ // But we also want to show special value codes. We call ` base::is.na()` to dispatch
95
+ // the ` is.na()` function and then replace those with ` FormattedValues::NA` .
96
96
let is_na = RFunction :: from ( "is_na_checked" )
97
97
. add ( x)
98
98
. call_in ( ARK_ENVS . positron_ns ) ;
@@ -103,26 +103,26 @@ fn format_object(x: SEXP) -> Vec<FormattedValue> {
103
103
. into_iter ( )
104
104
. zip ( unsafe { LogicalVector :: new_unchecked ( is_na. sexp ) . iter ( ) } )
105
105
. map ( |( v, is_na) | {
106
- // we don't expect is.na to return NA's, but if it happens, we treat it as false
106
+ // We don't expect is.na to return NA's, but if it happens, we treat it as false
107
107
if is_na. unwrap_or ( false ) {
108
108
FormattedValue :: NA
109
109
} else {
110
- // base::format defaults to using `trim=FALSE`
111
- // so it will add spaces to the end of the strings so all elements of the vector
112
- // have the same fixed width. We don't want this behavior in the data explorer,
110
+ // ` base::format` defaults to using `trim=FALSE`
111
+ // So it will add spaces to the end of the strings causing all elements of the vector
112
+ // to have the same fixed width. We don't want this behavior in the data explorer,
113
113
// We tried passing `trim=TRUE` but this is unfortunately not supported for eg. `factors`:
114
114
// > format(factor(c("aaaa", "a")), trim = TRUE)
115
115
// [1] "aaaa" "a "
116
116
//
117
- // so we will just trim the spaces manually, which is not ideal, but it's better than
117
+ // So we will just trim the spaces manually, which is not ideal, but it's better than
118
118
// having the values misaligned
119
119
FormattedValue :: Value ( v. trim_matches ( |x| x == ' ' ) . to_string ( ) )
120
120
}
121
121
} )
122
122
. collect ( )
123
123
} ,
124
124
Err ( _) => {
125
- // if we fail to get the is.na() values we will just return the formatted values
125
+ // If we fail to get the is.na() values we will just return the formatted values
126
126
// without additional treatments.
127
127
formatted. into_iter ( ) . map ( FormattedValue :: Value ) . collect ( )
128
128
} ,
0 commit comments